AlexeyAB / darknet

YOLOv4 / Scaled-YOLOv4 / YOLO - Neural Networks for Object Detection (Windows and Linux version of Darknet )
http://pjreddie.com/darknet/
Other
21.65k stars 7.96k forks source link

Cannot load image when detecting multiple images #6392

Open joy-eveline opened 4 years ago

joy-eveline commented 4 years ago

I built a custom object detector using tiny Yolov4 on Google Colab. Now I am trying to detect multiple images and save the prediction results to a txt file.

I'm using this command line: ! ./darknet detector test data/obj.data cfg/yolov4-tiny-obj.cfg /mydrive/tiny-yolov4/backup/yolov4-tiny-obj_best.weights -dont_show -ext_output < /mydrive/img.txt > result.txt

This is my input img.txt: image

Whe I run this, it tells me it can't load the images: image

I have already tried changing from .jpg to .png, made sure there are no empty lines, saved in utf-8 format.

If I run detection on each image seperately, it works.

Does anyone have a solution for this? Thanks.

ShaneXiangH commented 4 years ago

I have the same problem..

Does anyone have a solution for this?

stephanecharette commented 4 years ago

I don't know if this helps, but the DarkHelp wrapper has a --json flag where it will work on multiple images/videos and output a block of JSON text at the end. You can also use --keep to indicate you want it to annotate and keep all the images.

https://www.ccoderun.ca/darkhelp/api/ShellScripting.html

ShaneXiangH commented 4 years ago

Let me describe my problem in detail.

I just follow the steps in the Google Colab the wiki mentions to do the Compilation and Detection, see in this link: https://colab.research.google.com/drive/12QusaaRj_lUwCGDvQNfICpa7kA7_a2dE#scrollTo=ifqddnZ0yjCd

They work well until I enter into the "step 9: Multiple Images at Once" part. This instruction in that part cannot work well: YSL_F4BXQ1 O~39_LQGG8UC

Note that I changed the “path to image” parameter, since in my Google drive, the path is arranged in this structure: (PUFI${NWHYBOED39RS5J7V A1Y81(T~ MPT)I)N%$4MN4R

And in the images.txt, I followed the rules mentioned in the Colab and wrote like this: _ TB@$}JQ$WDY$39%EK5YXK

However, when I execute the instruction mentioned above, the output shows that it cannot load the images: %MG{6E`(WL} P$5XOR9ZMEL

And the json file I got by running the instuction: 9F{$0OP_{ CF$W`}GMTCPG6

is just: 5ZJTZQH~7`E4FZSSFAZ}M{5

I don't know where is the problem, since I didn't change any code or instructions on that Colab except the “path to image” parameter to access the files in my google drive. Does anyone have a solution for this?

stephanecharette commented 4 years ago

I've never used colab. But from that JSON file you posted, my first guess would be that you have \r\n line endings and it is expecting \n only.

ShaneXiangH commented 4 years ago

Ohh you are right, that works for me! Thank you!