AlexeyAB / darknet

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

Low loss and Low mAP for YoloV3 #7841

Closed MostafaMohamedEr closed 3 years ago

MostafaMohamedEr commented 3 years ago

Used: Command !./darknet detector train /content/Person.data /content/yolov3.cfg /content/realyolo.weights -map -dont_show -ext_output -clear

My Dataset 1500 instances of ImageNet person class, after removing misleading photos using pretrained model coco to detect images with low predictions and wrong annotations

what Loss and mAP did you get? loss 0.66 with 44 mAP chart_yolov3_1500Imgs

MostafaMohamedEr commented 3 years ago

@AlexeyAB Any suggestions?

AlexeyAB commented 3 years ago

Try to follow this FAQ: https://github.com/AlexeyAB/darknet/wiki/FAQ---frequently-asked-questions#1-i-get-low-accuracy

sunzhoujun commented 3 years ago

你有看控制台上计算map的结果吗,我碰到你类似的问题,观察训练时控制台输出计算map的结果发现有些类别的ap为0,不知道你是不是同样的问题?

MostafaMohamedEr commented 3 years ago

@AlexeyAB Any suggestions? @AlexeyAB I did all the instructions, there were some images with missing annotations, i deleted it and i viewed the images using yolo_Mark and deleted all wrong samples. Then i added negative samples images. Then i trained the yoloV3 model on 1k accuracate images and 3k accurate images. All these training experiments produced low mAP yolo_FinalImgNet_6000_Negative I am really confused, I tried everything. mAP didn't exceed 50%. I tried training YOLOV4 with the same data it gets 72% mAP, but didn't improve along with the training. i don't know why. yoloV4_4000

AlexeyAB commented 3 years ago
MostafaMohamedEr commented 3 years ago

你有看控制台上计算map的结果吗,我碰到你类似的问题,观察训练时控制台输出计算map的结果发现有些类别的ap为0,不知道你是不是同样的问题? I train a model on detecting pedestrians, so i have only one class to detect (person), So no there is no 0AP for the person class When i use darknet map i get slightly higher mAP, but no 0AP. here is a a sample from my list trained map I

MostafaMohamedEr commented 3 years ago
* Show 2 outputs for ./darknet detector map .. for training and validation datasets for both yolov3 and yolov4

First, Thanks sir for your interest This is YoloV3 Output yolov3 YoloV4Output yoloV4

MostafaMohamedEr commented 3 years ago
* Attach cfg-files in zip/txt format

yoloCFG.zip

MostafaMohamedEr commented 3 years ago
* Show detection results on 3 images: training, validation, any 3rd party from real case

Using YOLOV3 Train Image trainYoloV3 Test Image test Real Image Capture

MostafaMohamedEr commented 3 years ago
* Do this command, don't use this anchor, just show me the point cloud: `./darknet detector calc_anchors data/obj.data 

@AlexeyAB -num_of_clusters 9 -width 608 -height 608 -show` Anchors using 608 Capture Anchors using 416, as i train using 416 capture2 IF you need to see the data i will download the data from the drive in 5 min and upload the anchors

AlexeyAB commented 3 years ago
* Show 2 outputs for ./darknet detector map .. for training and validation datasets for both yolov3 and yolov4

First, Thanks sir for your interest This is YoloV3 Output yolov3 YoloV4Output yoloV4

Is it for validation dataset? Can you set valid=train.txt in obj.data file and calc mAP for these 2 models?

MostafaMohamedEr commented 3 years ago

@AlexeyAB Here are the map for training imgs YoloV3 yolov3

YoloV4 (Note: YoloV4 was trained for 3000 correct images that 1000 training images are proportion) yoloV4

AlexeyAB commented 3 years ago

Did you use such training command? ./darknet detector train /content/Person.data /content/yolov4.cfg yolov4.conv.137 -map -dont_show -ext_output -clear

And this pretrained weights file? https://github.com/AlexeyAB/darknet/releases/download/darknet_yolo_v4_pre/yolov4.conv.137

If yes, then there are several solutions:


Also:

MostafaMohamedEr commented 3 years ago

Did you use such training command? ./darknet detector train /content/Person.data /content/yolov4.cfg yolov4.conv.137 -map -dont_show -ext_output -clear

And this pretrained weights file? https://github.com/AlexeyAB/darknet/releases/download/darknet_yolo_v4_pre/yolov4.conv.137 Yes, i did There is no chance to increase the accuracy of yoloV3, as i am working on social distancing and fps is important? is there any news about yoloWithLstm Tracker, I am waiting for the improvements

  • Collect more training data

  • try to train longer, for [net] max_batches=12000 and increase steps in cfg

  • Try to train and use with higher resolution 608x608

I will try these steps and provide a feedback, thanks and sry for disturb

AlexeyAB commented 3 years ago

Can you show mAP for valid dataset for network resolution for yolov4.cfg (and you already trained weights)?

If the mAP is higher than in v3, then just use v4 with lower resolution if you need speed. Another way, just try to use OpenCV (compiled with CUDA/cuDNN) for inference, it can be 1.5 - 3x faster than Darknet:

MostafaMohamedEr commented 3 years ago

If the mAP is higher than in v3, then just use v4 with lower resolution if you need speed. Another way, just try to use OpenCV (compiled with CUDA/cuDNN) for inference, it can be 1.5 - 3x faster than Darknet:

Yes i installed openCV 4.5.1 WIth GPU, i get 15 FPS with yolo V3 using gtx1050 4GB, but i haven't tried yoloV4, and i haven't implemented tracking yet

Edit: I trained a yoloV4 on the last 1k training set for 3000 batches: it produced 75mAP for 608 with 19sec, 72 for 382 with 13 sec on colab pro Here are the results 608 608x608

384 382

352 352

AlexeyAB commented 3 years ago

How many sec do you get by using v3 416x416?

I mean that you can use YOLOv3/v4 directly in OpenCV without Darknet, and it can be faster: https://github.com/AlexeyAB/darknet/issues/7841#issuecomment-871642578

MostafaMohamedEr commented 3 years ago

How many sec do you get by using v3 416x416?

I mean that you can use YOLOv3/v4 directly in OpenCV without Darknet, and it can be faster: #7841 (comment) Oh, i got it. I tried yolo V3 416 on the darknet, it resulted in same time of yoloV4 382, but Yolo V4 is more accurate yoloV3_Gpu

and, i tried the both on opencv.DNN there was slight difference, i will use yoloV4 with lower dimensions , thanks for the advice

YoloV3 using openCV yoloV3-416

yoloV4 using openCV yoloV4-352

i hope getting better accuracy

AlexeyAB commented 3 years ago

Try to use cv::dnn::DNN_BACKEND_CUDA and cv::dnn::DNN_TARGET_CUDA_FP16 in OpenCV-dnn

MostafaMohamedEr commented 3 years ago

FP16 Using FP16 disable GPU , i don't know why, i use same without FP16 sss

MostafaMohamedEr commented 3 years ago

@AlexeyAB chart_yolov4Part2 I don't think the loss will decrease more than that, should i decrease the learning rate? ( i trained it for more than 10k iteration, and it stuck between 1.8 and 2.0) There is a thing, i don't know is it a bug or a problem with my files, using ./darknet detector gets a different score than plotted while training, as i got 74mAP, but plotted as 65

MostafaMohamedEr commented 3 years ago

The problem is solved by increasing the number of training images and deleting bad annotated images

1343464520 commented 3 years ago

你有看控制台上计算map的结果吗,我碰到你类似的问题,观察训练时控制台输出计算map的结果发现有些类别的ap为0,不知道你是不是同样的问题?

你好,我遇到的跟你描述的一样,我的两个类别,但是其中一个ap为0,不知道为啥?请问怎么解决呢?谢谢!

sunzhoujun commented 3 years ago

我后面发现是数据的问题,你可以训练的时候加一个-show_imgs看看能不能看到你的标注框,如果不能看到说明是数据出了问题,我检查的结果是我的标签没对上。

在 2021-07-09 15:25:42,"1343464520" @.***> 写道:

你有看控制台上计算map的结果吗,我碰到你类似的问题,观察训练时控制台输出计算map的结果发现有些类别的ap为0,不知道你是不是同样的问题?

你好,我遇到的跟你描述的一样,我的两个类别,但是其中一个ap为0,不知道为啥?请问怎么解决呢?谢谢!

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

1343464520 commented 3 years ago

谢谢回复。我尝试了单独去训练ap为0的那一类,训练是正常的,ap都能到99,测试也正常,就是把两类数据一起训练就不行。不知道啥原因

---Original--- From: @.> Date: Fri, Jul 9, 2021 17:27 PM To: @.>; Cc: @.**@.>; Subject: Re: [AlexeyAB/darknet] Low loss and Low mAP for YoloV3 (#7841)

我后面发现是数据的问题,你可以训练的时候加一个-show_imgs看看能不能看到你的标注框,如果不能看到说明是数据出了问题,我检查的结果是我的标签没对上。

在 2021-07-09 15:25:42,"1343464520" @.***> 写道:

你有看控制台上计算map的结果吗,我碰到你类似的问题,观察训练时控制台输出计算map的结果发现有些类别的ap为0,不知道你是不是同样的问题?

你好,我遇到的跟你描述的一样,我的两个类别,但是其中一个ap为0,不知道为啥?请问怎么解决呢?谢谢!

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe. — You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.