Darknet: Extremely inaccurate reading.

Created on 4 Apr 2019  路  55Comments  路  Source: AlexeyAB/darknet

I been trying to train YOLO to read image of fast food trash, but YOLO constantly makes prediction in places that doesn't really make any sense whatsoever. And the more I train, the more crazier YOLO becomes.
Overload
OverPie
This is with an avg loss of 0.09 and over 4000+ iteration.

I do have to mention I used 128 x 128 image to train, but this issue still pops up when I used high resolution image.

question

All 55 comments

Check your dataset by using Yolo_mark.

My dataset seems to be fine and mostly accurate, though is item overlapping a problem?
marker

  1. What mAP can you get on Training dataset?
  2. What mAP can you get on Validation dataset?
  3. Can you rename cfg-file to txt and attach it?
  4. If you use Linux, then what parameters did you use in the Makefile?

I am using Windows.
Can I ask how to get mAP for the dataset?
And I do not understand Question 3.

https://github.com/AlexeyAB/darknet#when-should-i-stop-training
darknet.exe detector map data/obj.data yolo-obj.cfg backup\yolo-obj_7000.weights

  1. set valid=train.txt in obj.data file and do this command
  2. set valid=valid.txt in obj.data file and do this command
  3. show your cfg-file

IoU threshold = 50 %
mean average precision ([email protected]) = 0.323183, or 32.32 %
IoU threshold = 50 %
mean average precision ([email protected]) = 0.323183, or 32.32 %

cfg1
cfg2

IoU threshold = 50 %
mean average precision ([email protected]) = 0.323183, or 32.32 %

This is not very bad accuracy for Yolo v2.

  1. What command did you use for training?
  2. What command do you use for detection?
  3. Can you show several images with results of detection on Training images?

  1. darknet.exe detector train cfg/obj.data cfg/yolo-obj.cfg yolo-obj_last.weights
    2.
    darknet.exe detector test cfg/obj.data cfg/yolo-obj.cfg yolo-obj_last.weights data/i/20.jpg
    3.
    B1
    B2
    B3
    B4

Hello? Are you still there? I don't want to be pushy, but I really need to do this right.

Can you share your dataset (images, labels, train.txt, obj.data, obj.names) and your cfg-file? For example, by using Google disk?

Is there anything wrong with the data I have, or do I just need to train ever longer (though I feel Yolo gets crazier when I train it for a long time)

@AlexeyAB are you available now?

@Soccer9001 Hi,

Yes, your Yolo v2 model trained very bad.

Also I didn't find test.txt with Test/Valid images. And your train.txt contains much more images than you send me in the zip-archive. So i created my own mixset_train.txt

To avoid overfitting you should use 2x-4x more images, with higher resolution and use separate validation dataset to check the mAP.


I just trained yolov3.cfg Yolo v3 model with width=192 height=192, with recalculated anchors and pre-trained weights darknet53.conv.74 for only 1300 iterations and get mAP = 98.32% that is very high.

cfg-file, commands and mixset_train.txt: YoloStuff.zip

chart

cloud

Detection results are pretty good:

predictions
predictions
predictions
predictions
predictions
predictions
predictions
predictions
predictions

image
image

I am trying to re-train my data with better image quality, but I will check out the data you gave me. I will let you know if things work out.

Thank you for your help btw, I was super confused about everything and felt very useless.

Actually, I am trying out your stuff with a 640 x 640 image now. Should I consider increasing width and height of the cfg file to something higher?

@Soccer9001

Yes, set batch=64 subdivisions=32 width=416 height=416 in yolov3-obj.cfg

When I tried to run with a higher width and height, my computer ran out of memory despite setting it to subdiv 64 already, so I kept it at 192 x 192. Still, here is my result.
chart
AlexBetter
AlexBetter2
There are still some misread burger boxes, but overall much more stable. What should I do at this point to further improve? Should I try increasing subdiv even more so that I can increase width and height? Or do I just run Yolo for longer?

Thank you for your help as always.

Start training from the begining with batch=64 subdivisions=64 width=320 height=320 in yolov3-obj.cfg

And train at least 6000 iterations.

Okay, I will do that when I get the chance.

It is possible for me to run your yolo on a Jupyter notebook? My computer isn't the best but I have access to a good Jupyter notebook.

If so, can you teach me how to run it there? I am very new to Jupyter.

Hey @AlexeyAB , I am trying to integrate Yolo into a html to run, so I am wondering if it is possible to run yolo detector via a python script instead of having to run it from commard prompt everytime.

Hi @AlexeyAB , sorry for the long wait, I hope you are still getting this. Here is my results. I couldn't run the training program even at 320 x 320, so I went to 256 x 256 instead. The results are somewhat mixed. It is better than v2 training, but it is still making a lot of mistakes and missing a lot of objects.
chart
P4
P5
P6
P8
P9
P10
P121
P1
P2
P3

What should I do now to further improve the model?

Hello @AlexeyAB? Are you still there?

@AlexeyAB Hello? Maybe I should close this thread and create a new one?

@Soccer9001 Hi,

  • Can you attach cfg-file that you used?

  • Did you use random=1 for training?

  • Did you use default anchors, your calculated anchors, or anchors from cfg-file from archive YoloStuff.zip https://github.com/AlexeyAB/darknet/issues/2843#issuecomment-480509467 ?

  • What command did you use for training?

  • What params did you use in Makefile?

Hello @AlexeyAB

  1. Here.
    ABzip.zip

  2. I believe I did. But to be specific, which random are you talking about?

  3. The only thing I touched from the cfg was subdiv, height and width.

  4. darknet detector train obj.data yolov3-obj.cfg darknet53.conv.74 -map

  5. What is a Makefile?

MyRig

So all I have to do is replace line 782 with the line you provided me then run the training program again?

GPUram
So only those three lines need to change, anything else?

Only these 3 lines

Okay, should I continue with the 6000 int weight or start from the beginning

Start from the begining

@AlexeyAB Hello again. The result is slightly better, but still have some error. Anything else I can do to improve? My mAP seems to be capped at 60% to 78%, how can I improve it?.
chart
predictions
predictions
predictions
predictions
predictions
predictions
predictions
predictions

@Soccer9001 Hi,

  • You can add images with slightly randomly rotated an empty tray (and empty txt label files)

  • You can set:

max_batches = 12000
policy=steps
steps=10000,11000

  • What soft did you use to get cropped objects (like cv::grabCut())?
    N8C019v2

  • Latter I will add features: rotation and bluring for Training Yolo, so it will help too:

angles=
blur=

I used "medibang paint pro" to crop the pictures. I will try to take pictures of an empty tray later.

Those data is meant to be in the cfg file right?

You are adding new features? Will I have to re download everything to take advantage of it? When will it be out? I have a deadline within about 2 weeks.

What should I do now? Should I restart training again or wait for your new features?

@Soccer9001

Those data is meant to be in the cfg file right?

Yes.

You are adding new features? Will I have to re download everything to take advantage of it? When will it be out? I have a deadline within about 2 weeks.

What should I do now? Should I restart training again or wait for your new features?

If I add this feature this week, I will tell you.

Now you can try to train by using yolov3-spp.cfg with default anchors instead of yolov3.cfg.

  • Just change filters= and classes= for your number of objects in all 3 [yolo]-layers in cfg
  • And set in cfg in [net] section
max_batches = 12000
policy=steps
steps=10000,11000

Is there anything I need to change in the yolov3-spp.cfg file?
Just three class and filter, then max_batch + step?
Anything about anchor needs change?

Is there anything I need to change in the yolov3-spp.cfg file?
Just three class and filter, then max_batch + step?

Yes

Anything about anchor needs change?

Use default

The train process is taking a while (it is gonna take about two days to run the entire thing), but I want to make a quick update. Still has a mAp ceiling, but I haven't used the weight yet.
chart

Hi @AlexeyAB , bad news. I tried out the new weight, and this is overall a steo backwards. The result is similar to the one before, but now missing french fries and circling more non existent burger boxes.
chart
predictions
predictions

Hello @AlexeyAB, are you there? Any update on your new feature as well as what I should do from here?

@Soccer9001 Did you train yolov3-spp.cfg width=608 height=608 with default anchors?

I didn't try 608x608 because I ran out of memeory with the other one. I only set to 256x256. I could try it later.

I didn't touch the anchors, do you want me to replace the anchors in the file with the one you gave me previously?

@AlexeyAB Hello. I have tried to train with 608 x 608, unfortunately, it says Cuda is out of memory and recommend me to set subdivision to 64 even though I have already set it to 64.

@AlexeyAB Hello? Is there anything else I can do?

@AlexeyAB Hello? Please respond.

@Soccer9001 Hi,

Download the latest version of Darknet, compile it with GPU, cuDNN and OpenCV.
Take the best cfg-file that you got previously, add blur=1 parameter in the [net] section and train it from the begining.

Hi, I am done with Yolo right now for the most part. The accuracy wasn't the best but it was acceptable at the end. If I ever need your help again, I will contact you again. Thank you for your help and I will be closing this thread now.

Hi, What mAP did you get at the end?

Was this page helpful?
0 / 5 - 0 ratings