lufficc / SSD

High quality, fast, modular reference implementation of SSD in PyTorch
MIT License
1.52k stars 384 forks source link

test result #158

Closed zzu0654 closed 3 years ago

zzu0654 commented 4 years ago

Can the box coordinates of the detection object be output to txt text? just like this: 149 179 177 200

SamSamhuns commented 4 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

Screen Shot 2020-07-14 at 5 46 59 PM

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()
Screen Shot 2020-07-14 at 5 51 17 PM

Might be better to have the file open and close calls outside the main loop to increase efficiency.