-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
23c9e7e
commit ca09bc7
Showing
2 changed files
with
53 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import numpy as np | ||
import argparse | ||
|
||
# 检测结果后处理 | ||
|
||
def back_process(vd_name): | ||
txt_path = './result/img/%s/det/det.txt'%vd_name | ||
try: | ||
a = np.loadtxt(txt_path,delimiter=',') | ||
except: | ||
print("no %s file"%vd_name) | ||
|
||
# index_small = np.where(a[:,4]*a[:,5]<1000)[0] | ||
index_small = np.where((a[:,4]*a[:,5]<1000)&(a[:,3]>1080//2))[0] | ||
|
||
save_det = np.delete(a,index_small,axis=0) | ||
|
||
np.savetxt('./result/img/%s/det/det.txt'%vd_name,save_det,fmt="%d,%d,%.3f,%.3f,%.3f,%.3f,%.4f,%d,%d,%d") | ||
|
||
|
||
# txt_path = './result/img/b4/det/det.txt' | ||
# try: | ||
# a = np.loadtxt(txt_path,delimiter=',') | ||
# except: | ||
# a = np.loadtxt(txt_path) | ||
|
||
# index_near = np.where(a[:,2]<100)[0] | ||
# area = np.sort(a[:,4]*a[:,5])[-20:] | ||
# width = np.sort(a[:,4])[-20:] | ||
# length = np.sort(a[:,4])[-20:] | ||
# #print('length',length) | ||
# length_index = np.where(a[:,5] > 600)[0] | ||
# width_index = np.where(a[:,4] > 300)[0] | ||
# frame_length = a[length_index,0] | ||
# #print('fra asd',frame_length) | ||
# index_large = np.where(a[:,4]*a[:,5]>100000)[0] | ||
# #print(index_near,len(index_near) ) | ||
# #print('\n',index_large,len(index_large)) | ||
# delete_index = np.concatenate((index_near,index_large,length_index,width_index),axis=0) | ||
# save_list = np.delete(a,delete_index,axis=0) | ||
# #print(np.shape(save_list)) | ||
# #print(width) | ||
# np.savetxt('./result/img/b4/det/det.txt',save_list,fmt="%d,%d,%.3f,%.3f,%.3f,%.3f,%.4f,%d,%d,%d") | ||
|
||
|
||
if __name__ == '__main__': | ||
parser = argparse.ArgumentParser() | ||
parser.add_argument('--file', type=str, help='file name') | ||
|
||
opt = parser.parse_args() | ||
|
||
back_process(opt.file) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
python detector/to_img_by_name.py --file c1.mp4 | ||
python detector/yolov3/detect.py --source result/img/c1/img1 --output result/img/c1/det --img-size 1280 --save_txt | ||
python detector/det_process.py --file c1 | ||
python detector/det_process_by_name.py --file c1 | ||
python single_demo.py --seq_name c1 --step_times 4 |