Closed zzu0654 closed 3 years ago
After line 62 in demo.py
, just add
if len(boxes) > 0:
txt_file = open('boxes.txt', 'a')
np.savetxt(txt_file, boxes.flatten(), fmt='%f', newline = ", ")
txt_file.write('\n')
txt_file.close()
I get the following output txt file after running the demo.py. In each line, groups of four numbers represent a bounding box for that image
If you want the output you state, use this instead
if len(boxes) > 0:
txt_file = open('boxes.txt', 'a')
np.savetxt(txt_file, boxes.flatten(), delimiter='\n', fmt='%f')
txt_file.close()
Might be better to have the file open and close calls outside the main loop to increase efficiency.
Can the box coordinates of the detection object be output to txt text? just like this: 149 179 177 200