Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run YoloV3 detections on thousands of images and save outputs? #723

Closed
austinmw opened this issue Apr 21, 2018 · 120 comments
Closed

Run YoloV3 detections on thousands of images and save outputs? #723

austinmw opened this issue Apr 21, 2018 · 120 comments

Comments

@austinmw
Copy link

I've only figured out how to run detections on one image at a time, typing a new image filename each time. Is there any build-in way to run on an entire folder of images and save images with predictions to another folder?

@AlexeyAB
Copy link
Collaborator

Using this fork: https://github.com/AlexeyAB/darknet
you can use this command:
./darknet detector test data/voc.data yolo-voc.cfg yolo-voc.weights -dont_show < data/train.txt > result.txt

in the file data/train.txt you should have paths to images
in the file result.txt will be results of detections

@austinmw
Copy link
Author

austinmw commented Apr 21, 2018

Thanks for the reply. does that work with YoloV3 config files? edit: looks like it should, gonna try now!

@AlexeyAB
Copy link
Collaborator

@austinmw Yes.
For Yolo v3:
./darknet detector test ./cfg/coco.data ./cfg/yolov3.cfg ./yolov3.weights -dont_show < data/train.txt > result.txt

@austinmw
Copy link
Author

austinmw commented Apr 21, 2018

Thanks. Does this actually save images with bounding boxes overlaid or only save bounding box info into a txt file? Trying to piece the separate detection images into a video as my build is freezing when trying to pass videos

@AlexeyAB
Copy link
Collaborator

It only saves bounding box info into a txt file

@austinmw
Copy link
Author

Ah ok, happen to know any way to save prediction images like ./darknet detect only with multiple images?

@surajitkundu29
Copy link

@austinmw did you get the way to save the images instead of only text file

@worldmovers
Copy link

@AlexeyAB I am using darknet fork from the yolo website. I have already trained my model on yolov3 . Now I want to make prediction on a folder . I tried using this
./darknet detector test data/voc.data yolo-voc.cfg yolo-voc.weights -dont_show < data/train.txt > result.txt
but that's not working. Can you please help me

@austinmw
Copy link
Author

austinmw commented Jun 7, 2018

@surajitkundu29 I didn't find an option directly. One workaround is that it will save bounding boxes over video output. So what you could do is combine your images (if they are the same size) into a video, run detection on the video, then split them back up.

@AlexeyAB
Copy link
Collaborator

AlexeyAB commented Jun 7, 2018

@worldmovers Try to use this fork for detection: https://github.com/AlexeyAB/darknet

@mhusseinsh
Copy link

@AlexeyAB Is there a way to save output images with bounding boxes in a different folder ?
I have a directory with thousands of input images, and I created an input.txt path for the images, and I am passing them in the command, but the output is always overriden for each frame on predictions.png
I need to save multiple outputs
what can I do ?

@PeterQuinn925
Copy link

PeterQuinn925 commented Jul 30, 2018 via email

@mhusseinsh
Copy link

@PeterQuinn925
I already did a little bash, which performs the images one by one, but the problem which i am facing now, is that each time, the image is saved as predictions.png, so it is always overwritten

and I am trying to find a way to avoid that

here is how I do it
cat imagenames.txt | ./darknet detect cfg/yolov3.cfg yolov3.weights

@berinhard
Copy link

@mhusseinsh I've forked darknet and implemented an ad-hoc solution that worked for me. If you want to take a look, here's the commit.

@Muhammad057
Copy link

@mhusseinsh
Here's a python code to save multiple images from a test.txt file.

import os
import glob
os.system
import PIL
import PIL.Image as Image

d = 0
test_Path = r'E:\ANPR\darknet\build\darknet\x64\data\test'
with open((test_Path + '.txt'),'r') as fobj:
for line in fobj:
image_List = [[num for num in line.split()] for line in fobj]
for images in image_List:
commands = ['darknet.exe detector test data/obj.data yolo-obj_test.cfg backup/yolo-obj_4900.weights -dont_show', images[0]]
os.system(' '.join(commands))
predicted_image = Image.open("E:/ANPR/darknet/build/darknet/x64/predictions.jpg")
output = "E:/ANPR/darknet/build/darknet/x64/data/predictedimages/predicted_image%d.jpg"%d
predicted_image.save(output)
d+=1

@buzdarbalooch
Copy link

hi,

i ran that script successfully, in the result.txt file it stores the predicted class of each image in the train.txt and % of the prediction. What if for each prediction. One wants the coordinates of the bounding boxes of the predicted class in the image.

@buzdarbalooch
Copy link

@AlexeyAB can you please help?

@vikasmishra591
Copy link

Hi,
I am getting prediction for single images but when I tried for multiple images it is creating result.txt file but empty and showing error like could not open names.list file.

@rodrigoap
Copy link

There is a -out option:

./darknet detect cfg/yolov3-tiny.cfg yolov3-tiny.weights data/dog.jpg -out myfile

Will write the image to myfile.jpg

@srhtyldz
Copy link

There is a -out option:

./darknet detect cfg/yolov3-tiny.cfg yolov3-tiny.weights data/dog.jpg -out myfile

Will write the image to myfile.jpg

can you do that for the folder that contains test images =?

@srhtyldz
Copy link

@AlexeyAB I am using darknet fork from the yolo website. I have already trained my model on yolov3 . Now I want to make prediction on a folder . I tried using this
./darknet detector test data/voc.data yolo-voc.cfg yolo-voc.weights -dont_show < data/train.txt > result.txt
but that's not working. Can you please help me

That script also does not worked for me .How did you find a solution to save output of test data ?

@vincentgong7
Copy link

vincentgong7 commented Dec 13, 2018

Updated: May 07, 2020

I added the function of exporting the bounding box coordinates and classes names, confidence for each image in an input folder.

Now it supports:

  • Detect objects for multiple images in an input folder.
  • Export detected result (images) into the output folder.
  • Export a TXT file with image names, detected classes, confidence and bounding box coordinates.
  • Export a JSON file with image names, detected classes, confidence and bounding box coordinates.

Try now:

https://darknet.gong.im/

Updated: May 14, 2019

Batch images detection using Yolo on AexeyAB Darknet:
https://darknet.gong.im/

I added this function in the source code and resolve this problem with command:

Command

./darknet detector batch cfg/coco.data cfg/yolov3.cfg weights/yolov3.weights batch exp/in_images/ exp/out_images/ > result/results.txt

Parameter explain:

  1. The input images are: in_images/
  2. The output images are: out_images/
  3. The detection classes with percentage is saved in: exp/results/results.txt

As AlexeyAB updates frequently, hereby I added a stable version of AlexeyAB Darknet with extra convenient functions into my Github repos.
https://github.com/vincentgong7/VG_AlexeyAB_darknet

Usage

  1. Clone this project. See the repo in above link.
  2. Download pre-trained weights file into foder ./weights/. Such as:
    https://pjreddie.com/media/files/yolov3-openimages.weights
  3. Make the project with command in VG_AlexeyAB_darknet/ folder:

make

  1. Use the command described above to perform batch detecting images.

Contact

Any questions please let me know.
vincent.gong7[at]gmail.com
http://www.gong.im

Best Regards,
Vincent

@vincentgong7
Copy link

@AlexeyAB I am using darknet fork from the yolo website. I have already trained my model on yolov3 . Now I want to make prediction on a folder . I tried using this
./darknet detector test data/voc.data yolo-voc.cfg yolo-voc.weights -dont_show < data/train.txt > result.txt
but that's not working. Can you please help me

That script also does not worked for me .How did you find a solution to save output of test data ?

Solved! Please see my answer above.

@vincentgong7
Copy link

hi,

i ran that script successfully, in the result.txt file it stores the predicted class of each image in the train.txt and % of the prediction. What if for each prediction. One wants the coordinates of the bounding boxes of the predicted class in the image.

Solved! Please see my answer above.

@vincentgong7
Copy link

@AlexeyAB Is there a way to save output images with bounding boxes in a different folder ?
I have a directory with thousands of input images, and I created an input.txt path for the images, and I am passing them in the command, but the output is always overriden for each frame on predictions.png
I need to save multiple outputs
what can I do ?

Solved! Please see my answer above.

@vincentgong7
Copy link

@surajitkundu29 I didn't find an option directly. One workaround is that it will save bounding boxes over video output. So what you could do is combine your images (if they are the same size) into a video, run detection on the video, then split them back up.

Solved! Please see my answer above.

@Yddeon
Copy link

Yddeon commented Dec 14, 2018

I added this function in the source code and resolve this problem with command:

./darknet detector test cfg/coco.data cfg/yolov3.cfg weights/yolov3.weights batch ./in_images/ ./out_images/ >./results.txt

Parameter explain:

* The input images are: `./in_images/`

* The output images are: `./out_images/`

* The detection classes with percentage is saved in: `./results.txt`

To reach this, you need to replace the attached detector.c into ./src/ folder and re-make the AlexeyAB darknet.

Detail process:

1. Install the AlexeyAB/darknet, see: [github link](https://github.com/AlexeyAB/darknet). The darknet is installed in the folder: `darknet/`

2. Replace the `darknet/src/detector.c` with the detector.c in attached.
   [detector.c.zip](https://github.com/pjreddie/darknet/files/2674089/detector.c.zip)

3. Make the project with command in `darknet/` folder:
   `make`

4. If you have already did the make, you may do re-make with commands:
   `clean`
   `make`

You may still do for one image with:
./darknet detector test cfg/coco.data cfg/yolov3.cfg weights/yolov3.weights ./data/dog.jpg

Any questions please let me know.
vincent.gong7[at]gmail.com

Best Regards,
Vincent

I managed to make your solution work but I'm still having some issues with the output!
I have a bunch of .jpg images ordered in in_images folder (1.jpg, 2.jpg ... 30.jpg) and it's succesfully saving them all but as 1.jpg.png, 2.jpg.png..

Is there a way to remove the .jpg from input files? Or keep them as jpg when saving

I'm currently solving this by running find -type f -name '*.png' | while read f; do mv "$f" "${f%.png}"; done
after the program is done but it would be nice if the oput was already the one I'm expecting without running anything afterwards

@vincentgong7
Copy link

I added this function in the source code and resolve this problem with command:

./darknet detector test cfg/coco.data cfg/yolov3.cfg weights/yolov3.weights batch ./in_images/ ./out_images/ >./results.txt

Parameter explain:

* The input images are: `./in_images/`

* The output images are: `./out_images/`

* The detection classes with percentage is saved in: `./results.txt`

To reach this, you need to replace the attached detector.c into ./src/ folder and re-make the AlexeyAB darknet.

Detail process:

1. Install the AlexeyAB/darknet, see: [github link](https://github.com/AlexeyAB/darknet). The darknet is installed in the folder: `darknet/`

2. Replace the `darknet/src/detector.c` with the detector.c in attached.
   [detector.c.zip](https://github.com/pjreddie/darknet/files/2674089/detector.c.zip)

3. Make the project with command in `darknet/` folder:
   `make`

4. If you have already did the make, you may do re-make with commands:
   `clean`
   `make`

You may still do for one image with:
./darknet detector test cfg/coco.data cfg/yolov3.cfg weights/yolov3.weights ./data/dog.jpg
Any questions please let me know.
vincent.gong7[at]gmail.com
Best Regards,
Vincent

I managed to make your solution work but I'm still having some issues with the output!
I have a bunch of .jpg images ordered in in_images folder (1.jpg, 2.jpg ... 30.jpg) and it's succesfully saving them all but as 1.jpg.png, 2.jpg.png..

Is there a way to remove the .jpg from input files? Or keep them as jpg when saving

I'm currently solving this by running find -type f -name '*.png' | while read f; do mv "$f" "${f%.png}"; done
after the program is done but it would be nice if the oput was already the one I'm expecting without running anything afterwards

Thanks Yddeon, I'll modify on it before next week.
BR,
Vincent

@vincentgong7
Copy link

vincentgong7 commented Jul 3, 2020 via email

@RoshniKoli
Copy link

Hi, I guess that you want to detect objects from multiple images, correct?
On Fri, 3 Jul 2020 at 15:24, RoshniKoli @.***> wrote: Using command - Get-Content | .\darknet.exe detector test .\cfg\Data.data .\cfg\yolov3_cvfashion_test.cfg .\yolov3_cvfashion_train.backup -dont_show -ext_output > result_cv.txt The program runs but i get this error - [yolo] params: iou loss: mse (2), iou_norm: 0.75, cls_norm: 1.00, scale_x_y: 1.00 Total BFLOPS 139.683 avg_outputs = 1108870 Loading weights from .\yolov3_cvfashion_train.backup...Done! Loaded 107 layers from weights-file Cannot load image ???? Cannot load image � Cannot load image �� ������ The image paths work when I test it one at a time using detector test command. The same paths as input to above code throw that error. Please suggest. — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub <#723 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABSXEI6DMVUVTVYG6R7A2KTRZXLYDANCNFSM4E32P4WQ .
-- Regards, Vincent X. Gong

Yes.

@vincentgong7
Copy link

vincentgong7 commented Jul 3, 2020 via email

@RoshniKoli
Copy link

Try this: https://darknet.gong.im It’s made for the batch images detection using Yolo.
On Fri, 3 Jul 2020 at 16:42, RoshniKoli @.> wrote: Hi, I guess that you want to detect objects from multiple images, correct? On Fri, 3 Jul 2020 at 15:24, RoshniKoli @.> wrote: Using command - Get-Content | .\darknet.exe detector test .\cfg\Data.data .\cfg\yolov3_cvfashion_test.cfg .\yolov3_cvfashion_train.backup -dont_show -ext_output > result_cv.txt The program runs but i get this error - [yolo] params: iou loss: mse (2), iou_norm: 0.75, cls_norm: 1.00, scale_x_y: 1.00 Total BFLOPS 139.683 avg_outputs = 1108870 Loading weights from .\yolov3_cvfashion_train.backup...Done! Loaded 107 layers from weights-file Cannot load image ???? Cannot load image � Cannot load image �� ������ The image paths work when I test it one at a time using detector test command. The same paths as input to above code throw that error. Please suggest. — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub <#723 (comment) <#723 (comment)>>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABSXEI6DMVUVTVYG6R7A2KTRZXLYDANCNFSM4E32P4WQ . -- Regards, Vincent X. Gong Yes. — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub <#723 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABSXEIZ66THIA4M7THXRU7DRZXU6BANCNFSM4E32P4WQ .
-- Regards, Vincent X. Gong

Hi Vincent,

I built your project and tried using the batch command. In that command, do I have to specify the path to images folder or a list of paths ? Can you please clarify? Thanks in advance.

@vincentgong7
Copy link

vincentgong7 commented Jul 4, 2020 via email

@neheteakshay
Copy link

@vincentgong7 Sir, Can you help me to get only detected object(Licence plate) only from video?

@RoshniKoli
Copy link

Hi, You just need to specify the input folder folder and the output folder. The input folder: a folder contain all images to be detected. The output folder: the folder that the yolo will save detected images to. In the web page (https//darknet.gong.im) there is a explanation of each parameters in the command. Let me know if you have any questions. BR, Vincent
On Sat, 4 Jul 2020 at 16:44, RoshniKoli @.*> wrote: Try this: https://darknet.gong.im It’s made for the batch images detection using Yolo. On Fri, 3 Jul 2020 at 16:42, RoshniKoli @.> wrote: Hi, I guess that you want to detect objects from multiple images, correct? On Fri, 3 Jul 2020 at 15:24, RoshniKoli @.> wrote: Using command - Get-Content | .\darknet.exe detector test .\cfg\Data.data .\cfg\yolov3_cvfashion_test.cfg .\yolov3_cvfashion_train.backup -dont_show -ext_output > result_cv.txt The program runs but i get this error - [yolo] params: iou loss: mse (2), iou_norm: 0.75, cls_norm: 1.00, scale_x_y: 1.00 Total BFLOPS 139.683 avg_outputs = 1108870 Loading weights from .\yolov3_cvfashion_train.backup...Done! Loaded 107 layers from weights-file Cannot load image ???? Cannot load image � Cannot load image �� ������ The image paths work when I test it one at a time using detector test command. The same paths as input to above code throw that error. Please suggest. — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub <#723 <#723> (comment) <#723 (comment) <#723 (comment)>>>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABSXEI6DMVUVTVYG6R7A2KTRZXLYDANCNFSM4E32P4WQ . -- Regards, Vincent X. Gong Yes. — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub <#723 (comment) <#723 (comment)>>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABSXEIZ66THIA4M7THXRU7DRZXU6BANCNFSM4E32P4WQ . -- Regards, Vincent X. Gong Hi Vincent, I built your project and tried using the batch command. In that command, do I have to specify the path to images folder or a list of paths ? Can you please clarify? Thanks in advance. — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub <#723 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABSXEI5CNO222UI5OQ7OFRDRZ456TANCNFSM4E32P4WQ .
-- Regards, Vincent X. Gong

I tried that as well, the build on windows went right. But the command darknet.exe is not giving any output. The sample command doesn't execute as well. I am not sure what went wrong.

@vincentgong7
Copy link

vincentgong7 commented Jul 5, 2020 via email

@vincentgong7
Copy link

vincentgong7 commented Jul 5, 2020 via email

@peijason
Copy link

peijason commented Jul 22, 2020

What is the data/coco.data for darknet detector test ? It looks while testing, data/coco.data is pointless?

@murari2401
Copy link

murari2401 commented Jul 31, 2020

@AlexeyAB I am using darknet fork from the yolo website. I have already trained my model on yolov3 . Now I want to make prediction on a folder . I tried using this
./darknet detector test data/voc.data yolo-voc.cfg yolo-voc.weights -dont_show < data/train.txt > result.txt
but that's not working. Can you please help me

you can use this :

import os
import glob
import cv2
#os.system
import time
import PIL
import PIL.Image as Image

d = 0
test_Path = r"E:\yolo_v4\darknet\build\darknet\x64\c910"

images=[]
for filename in os.listdir(test_Path):
img=cv2.imread(os.path.join(test_Path,filename))

if img is not None:
	images.append(img)
commands = ['darknet.exe detector test data/objc.data cfg/yolov3-objc.cfg backup3/yolov3-objc_last.weights -dont_show', os.path.join(test_Path,filename)]
os.system(' '.join(commands))
predicted_image = Image.open("E:\\yolo_v4\\darknet\\build\\darknet\\x64\\predictions.jpg")

output = "E:/yolo_v4/darknet/build/darknet/x64/c910r/"+str(filename)

predicted_image.save(output)
d+=1

print(len(images))
print(d)

@vincentgong7
Copy link

vincentgong7 commented Jul 31, 2020 via email

@murari2401
Copy link

Using this fork: https://github.com/AlexeyAB/darknet
you can use this command:
./darknet detector test data/voc.data yolo-voc.cfg yolo-voc.weights -dont_show < data/train.txt > result.txt

in the file data/train.txt you should have paths to images
in the file result.txt will be results of detections

I Have given a input image and YOLOv3 gace output with bouding boxes. I tried to subtract input and output image then I observed yolo is modifying most of pixels in output .(When I have subtracted input and output images I should only get bounding box but instead I got much noisy image in output)

@Fetulhak
Copy link

Fetulhak commented Nov 1, 2020

import os
import glob
os.system
import PIL
import PIL.Image as Image

d = 0
test_Path = r'E:\ANPR\darknet\build\darknet\x64\data\test'
with open((test_Path + '.txt'),'r') as fobj:
for line in fobj:
image_List = [[num for num in line.split()] for line in fobj]
for images in image_List:
commands = ['darknet.exe detector test data/obj.data yolo-obj_test.cfg backup/yolo-obj_4900.weights -dont_show', images[0]]
os.system(' '.join(commands))
predicted_image = Image.open("E:/ANPR/darknet/build/darknet/x64/predictions.jpg")
output = "E:/ANPR/darknet/build/darknet/x64/data/predictedimages/predicted_image%d.jpg"%d
predicted_image.save(output)
d+=1

This works well. Here I have modified to save your predicted images based on the exact filename of your original image. This code also runs on Google Colab.

import os
import glob
os.system
import PIL
import PIL.Image as Image

test_Path = r'build/darknet/x64/data/test'
with open((test_Path + '.txt'),'r') as fobj:
for line in fobj:
image_List = [[num for num in line.split()] for line in fobj]
for images in image_List:
commands = ['./darknet detector test build/darknet/x64/data/trainer.data build/darknet/x64/cfg/yolo-obj.cfg build/darknet/x64/backup/yolo-obj_2000.weights -thresh 0.3 -iou_thresh 0.3 -dont_show', images[0]]
os.system(' '.join(commands))
predicted_image = Image.open("./predictions.jpg")
#based on the output of 'images[0]' you can manupilate the filename below
filename = images[0][27:]
#creat predictedimages folder in google colab based on your current working directory
output = "build/darknet/x64/data/predictedimages/%s"%filename
predicted_image.save(output)

@panban-ux
Copy link

Where in the code will i be able to extract the recognized class as word or hex to transfer it on the fly to my python lora python code?
Instead of say hello world over the lora i would like to transfer the detected objects, which of them or the number of them if i'll be able to count the same class object

@vincentgong7
Copy link

vincentgong7 commented Nov 9, 2020 via email

@panban-ux
Copy link

panban-ux commented Nov 9, 2020

Thanks Vincent, what im currently using is the Darknet-NNPACK for an SBC. How can effectively extract those JSON or .txt as happens in your repo? Then i will be able to write a python parser code.

@panban-ux
Copy link

Is there an example in python on how to print how many boats and how many persons of this JSON example:
{
"frame_id":2,
"filename":"sample_imgs/2.jpg",
"objects": [
{"class_id":8, "name":"boat", "relative_coordinates":{"left_x":1547, "top_y":1126, "width": 298, "height": 149}, "confidence":0.348690},
{"class_id":0, "name":"person", "relative_coordinates":{"left_x": 128, "top_y":1327, "width": 30, "height": 89}, "confidence":0.972903},
{"class_id":0, "name":"person", "relative_coordinates":{"left_x": 179, "top_y":1332, "width": 26, "height": 72}, "confidence":0.689888}

Used something like that but getting blanks
j = json.load(f)
c = Counter(k[4:] for d in j for k, v in d.items() if k.startswith('name'))
print(json.dumps(c, indent=2, sort_keys=True))

@pentanol2
Copy link

Using this fork: https://github.com/AlexeyAB/darknet
you can use this command:
./darknet detector test data/voc.data yolo-voc.cfg yolo-voc.weights -dont_show < data/train.txt > result.txt

in the file data/train.txt you should have paths to images
in the file result.txt will be results of detections

This does not work for me. I get the following error

Cannot load image "-dont_show"
STB Reason: can't fopen

@paulaceccon
Copy link

./darknet detector test cfg/coco.data cfg/yolov4.cfg yolov4.weights -ext_output -dont_show -out result.json < data/train.txt produces something like:

[
    {
     "frame_id":1, 
     "filename":"lpr/1.jpg", 
     "objects": [ 
      {"class_id":0, "name":"licence_plate", "relative_coordinates":{"center_x":0.739712, "center_y":0.930132, "width":0.138180, "height":0.062141}, "confidence":0.979332}
     ] 
    }
]

@rk8650
Copy link

rk8650 commented Dec 20, 2020

Hi @paulaceccon ,

I tried the command on my custom dataset:
! ./darknet detector test /content/data/obj.data /content/yolov4-obj.cfg /content/drive/MyDrive/sketch_backup/yolov4-obj_best.weights -ext_output -dont_show -out /content/result.json < /content/images.txt

But I am getting blank result.json while I am getting correct output

Also getting below error at end, is it stopping to put the output in json file ?
darknet: ./src/image.c:41: get_pixel: Assertion `x < m.w && y < m.h && c < m.c' failed.
/bin/bash: line 1: 2077 Aborted (core dumped) ./darknet detector test /content/data/ob

I am stuck with it from last 2 days. Please help

@paulaceccon
Copy link

What worked for me was:

./darknet detector test my.data yolov4-tiny.cfg yolov4-tiny_best.weights -ext_output -dont_show -out result.json < test.txt

@shubham-shahh
Copy link

What worked for me was:

./darknet detector test my.data yolov4-tiny.cfg yolov4-tiny_best.weights -ext_output -dont_show -out result.json < test.txt

Hi @paulaceccon @rk8650 @pentanol2
you can use this PR AlexeyAB#7282
it will run detections on all the images in the folder and also allows you to save the cropped images in a folder by un commenting the lines https://github.com/AlexeyAB/darknet/blob/master/src/image_opencv.cpp#L980-L996

@shubham-shahh
Copy link

@vincentgong7 Sir, Can you help me to get only detected object(Licence plate) only from video?

AlexeyAB#7276 this might help

@vincentgong7
Copy link

vincentgong7 commented Feb 10, 2021 via email

@neomukul
Copy link

@mhusseinsh
Here's a python code to save multiple images from a test.txt file.

import os
import glob
os.system
import PIL
import PIL.Image as Image

d = 0
test_Path = r'E:\ANPR\darknet\build\darknet\x64\data\test'
with open((test_Path + '.txt'),'r') as fobj:
for line in fobj:
image_List = [[num for num in line.split()] for line in fobj]
for images in image_List:
commands = ['darknet.exe detector test data/obj.data yolo-obj_test.cfg backup/yolo-obj_4900.weights -dont_show', images[0]]
os.system(' '.join(commands))
predicted_image = Image.open("E:/ANPR/darknet/build/darknet/x64/predictions.jpg")
output = "E:/ANPR/darknet/build/darknet/x64/data/predictedimages/predicted_image%d.jpg"%d
predicted_image.save(output)
d+=1

Did some changes but works good. thankyou....

@pabsan-0
Copy link

pabsan-0 commented Mar 22, 2021

Hello, I struggled with batch inferring for some time and would like to share my solution. It is a python script to be run after running darknet for predictions so that images will be modified from a log text file. See more inside the very script. It is not perfect but it is quick and easy to use. Cheers!
darknet-yolo-batch-annotation.txt

@saktheeswaranswan
Copy link

@austinmw Yes. For Yolo v3: ./darknet detector test ./cfg/coco.data ./cfg/yolov3.cfg ./yolov3.weights -dont_show < data/train.txt > result.txt

@saktheeswaranswan
Copy link

Hi guys I made an python script that runs efficiently with any GPU if you have a big weights file it runs the detection and saves it on excel with time stamp and confidence you can also use live detection and save it in Excel file refer this youtube link please subscribe to appreciate my work I have done it elegantly its. Simple even you don't understand the language just watch the video and try it and you can also do it for images follow me on youtube I can guide you here is the link and code it's given in description for free

https://youtu.be/tKSiEslHVqI

@bijuangalees
Copy link

how to hide confidence score on predicted image on yolov2?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests