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

YOLOv7 0.00 mAP #485

Closed
emersondelemmus opened this issue Aug 11, 2022 · 13 comments
Closed

YOLOv7 0.00 mAP #485

emersondelemmus opened this issue Aug 11, 2022 · 13 comments

Comments

@emersondelemmus
Copy link

I am training on a one-class dataset. I made sure to change 'nc: 1' (number of classes = 1) in the yolov7.cfg. I am running it on anaconda and my data is being read correctly + training is executing. (AVG: Epoch Length 5 min -> 10 min @ 32 batch size).

This is my training command:
E:/yolov7/python train.py --batch 32 --img-size 640 --cfg E:/yolov7/cfg/training/yolov7.yaml --epochs 100 -- data E:/Trainig_Data/data.yaml --weights E:/yolov7/yolov7.pt --device 0

I set epochs to 100 just for a preliminary attempt. Overnight, I checked wandb.ai for the metrics at 67/100 epochs and there is no training done. mAP = 0.0, precision = 0.0, recall =0.0.

The training dataset should be completely fine because I used it to train YOLOv5 with no problems. Can anyone shed light on why mAP is stuck 0.0?

@Abandon-ht
Copy link

Can you provide more information about hyperparameters?

@emersondelemmus
Copy link
Author

Can you provide more information about hyperparameters?

Yes! Of course.

E:/yolov7/python train.py --batch 32 --img-size 640
--cfg E:/yolov7/cfg/training/yolov7.yaml --epochs 100
--data E:/Trainig_Data/data.yaml
--hyp E:/yolov7/data/hyp.scratch.p5.yaml
--weights E:/yolov7/yolov7.pt --device 0

@emersondelemmus
Copy link
Author

Capture

This is the end result incase it helps visualize my problem. For reference, training on the same dataset using YOLOv5 yielded 80% mAP.

@emersondelemmus
Copy link
Author

Can you provide more information about hyperparameters?

Also I should mention the hyp.scratch.p5.yaml I am using is the default one provided by this github with no changes.

@Abandon-ht
Copy link

Can you provide more information about hyperparameters?

Also I should mention the hyp.scratch.p5.yaml I am using is the default one provided by this github with no changes.

In README.md:
If you have previously used a different version of YOLO, we strongly recommend that you delete train2017.cache and val2017.cache files, and redownload labels.
Did you finished it?

@emersondelemmus
Copy link
Author

Can you provide more information about hyperparameters?

Also I should mention the hyp.scratch.p5.yaml I am using is the default one provided by this github with no changes.

In README.md: If you have previously used a different version of YOLO, we strongly recommend that you delete train2017.cache and val2017.cache files, and redownload labels. Did you finished it?

Correct, the .cache files were deleted and regenerated. I trained again last night, but I still received mAP 0.0 results over 100 epochs.

I am working with a tiled image dataset so I know my images contained a large number of Empty images, however, this should not be a problem.

Capture

@AlexeyAB
Copy link
Collaborator

Attach all charts from runs/train/
And check if it detect anything, to check if the issue is in training or validation.

@emersondelemmus
Copy link
Author

Results:
results
Confusion Matrix
confusion_matrix

results.txt

Test Batch 0 Label
test_batch0_labels

Test Batch 0 Prediction
test_batch0_pred

Test Batch 2 Label
test_batch2_labels

Test Batch 2 Predict
test_batch2_pred

Attach all charts from runs/train/ And check if it detect anything, to check if the issue is in training or validation.

@parto-mahdi
Copy link

Hello,
I have also the same issue, I trained the network without changing anything in codes with my own dataset for both yolo-tiny7 and yolo7-p5 and only for one class and I have the same problem for both. I changed the number of classes in every possible places;
Yolov7-tiny:
--data custom.yaml , --cfg yolov7-tiny.yaml
Yolov7-p5:
--data custom.yaml , --cfg yolov7.yaml
my custom.yaml file:
train: yolo-tiny/tiny7/train
test: yolo-tiny/tiny7/test
val: yolo-tiny/tiny7/val
#Classes
nc: 1 # replace according to your number of classes
#classes names
#replace all class names list with your classes names
names: ['myobject']
Training was done successfully, 100 epochs and it is finding my object perfectly fine with the average of 0.96 for IoUs and MAP 1.00 based on IoUs
but when it comes to confidence scores, the average is 0.50 for tiny and 0.52 for p5 and most of them are between 0.49 and 0.50
because of this the Map for threshold 0.7 according to confidence scores is 0
I think it is a small problem in settings but I have no idea where, I would appreciate if you help me for this....

@parto-mahdi
Copy link

@AlexeyAB
I would appreciate if consider my problem or if I need to start a new topic just please let me know.
Thanks

@AlexeyAB
Copy link
Collaborator

@parto-mahdi Could you try to train using the latest code

@Guiltytrees
Copy link

我遇到了同样的问题

@Guiltytrees
Copy link

是因为YOLOv7-tiny相比YOLOv5s、YOLOv4等更难收敛吗?同样的数据与参数设置,后两者可以正常训练

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

5 participants