-
Notifications
You must be signed in to change notification settings - Fork 8k
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
Official YOLOv7: Trainable bag-of-freebies sets new state-of-the-art for real-time object detectors #8595
Comments
Several questions:
|
@AlexeyAB @WongKinYiu thank you so much for the amazing work! very much excited for yolov7 |
Model inferernce time (without NMS)
Model inferernce time (with NMS)
|
@AlexeyAB Great work! |
@AlexeyAB Does YOLOv7 have new "things" in the .cfg file that requires changes to the C/C++ darknet code to run correctly? Or does the Darknet code from today have everything needed to use the new YOLOv7 configuration files? |
@stephanecharette I tested yolov7-tiny.cfg on my custom data & its working fine. |
it should already work, please open an issue if you find any problem |
Is there a possibility to get yolov7-tiny.cfg in yaml format? Want to test the new repo, and I can only use the cfg for darknet and there's no support yet on the yolov7 repo |
Training should work using these But accuracy could be lower than training on Pytorch code, because not all data augmentation and label-assignment approaches are implemented in the Darknet. |
There is yolov7-tiny (leaky_relu) in yaml format: https://github.com/WongKinYiu/yolov7/blob/main/cfg/training/yolov7-tiny.yaml You can try to train it using these hyper parameters: https://github.com/WongKinYiu/yolov7/blob/main/data/hyp.scratch.tiny.yaml Just delete old |
Those v7 weights when compared to a personal Yolov4-tiny set I've trained, using OpenCV 4.5.3 and CUDA 11.5 produce half the FPS. Lost more than half the FPS. I've yet to test the accuracy between them, but the FPS trade off between a smaller increase in accuracy feels too much. |
It is necessary to develop a tool to convert yaml to cfg both for traing and for inference. |
In the same batch, the performance of Darknet is better than that of pytorch, but the larger the batchsize is, the better the performance is. Can we save video memory in half precision and make the batchsize larger like yolov5? |
@AlexeyAB @WongKinYiu can you please update the repo with steps-'How to train with a custom dataset' as we have in Darknet's repo? |
I tried out the yolov7-tiny.weights from above and got some rather broken output. I've run various versions of yolvo[34] and have done GPU months of training, so I don't think this is a newbie fail. Very strange...
The scores are all very high (mostly 100%) and the x/y coords and dimensions are 0,0 or something like 2754,0 or 0,498 Oddly, with a rtsp source, it looked like some of the outputs where ~correct (cars with roughly correct bounding boxes, but low scores). sha1sums: |
|
Ah, thanks. The problem was there are two different versions of the yolov7-tiny.cfg, the one I was using (that I thought I downloaded with the weights) had an extra P5 section and some of the activation functions where linear and not logistic. The version from the git tree worked just fine. |
Hi @AlexeyAB , really great work on yolov7 Do you have plans on yolov7 darknet cfg file release? Currently only yolov7-tiny is released |
Are the weights you provided for yolov7-tiny here the same as the yolov7-tiny.pt weights from the pytorch repo? I've loaded both in pytorch, the .weights using the previous pytorch yolo repos and the .pt in the yolov7 repo and they seem to have different values. |
darknet-yolov7 is compatible and I could porte to work with darknet_ros smoothly. darknet_ros : https://github.com/Ar-Ray-code/darknet_ros_fp16 |
Hi, @AlexeyAB I tested your uploaded yolov7-tiny weight file on pytorch and darknet with COCO val 2017. I used ScaledYolov4 repo to directly run the same yolov7-tiny darknet weight file on pytorch. The followings are details of each result. mAP result from darknet (command: ./darknet detector map cfg/coco_val.data cfg/yolov7-tiny.cfg yolov7-tiny.weights): IoU threshold = 50 %, used Area-Under-Curve for each unique Recall |
@chjej202 There are different ways for AP calculation (different ways for AUC calculation: continuous,interpolation, ...) and so on. Try to use the same for both repos - or Pycocotool, or COCO-Codalab-server: https://github.com/AlexeyAB/darknet/wiki/How-to-evaluate-accuracy-and-speed-of-YOLOv4 In any case Pytorch could provide slightly better AP, because
|
Hi @AlexeyAB Thank you for your comment. pytorch version: darknet version: For AP_50 value, the gap between two results is just slightly reduced, but pytorch version is much better than darknet version (pytorch: 0.524, darknet: 0.496, gap: 0.034 => 0.028) Is there major difference between darknet and pytorch related to pre-/post-processing? |
For Inference and Validation - Yes. |
I added |
|
@AlexeyAB for yolov7x where is the .conv file for training ? Thanks! |
@AlexeyAB Thanks! |
now daknet support the yolov7_tiny yolov7 and yolov7x train the customed dateset? how about the accuracy whit he pytorch version? |
@AlexeyAB Thanks for the great work. I tried to train my own dataset using yolov7x, but something seems to be going wrong. The Loss curve first decreased and then increased, and the obtained mAP has a large fluctuation. What is the reason? |
I tested yolo v7 tiny with import cv2 as cv
import numpy as np
def main():
className = "./model/coco.names"
img = cv.imread("data/dog.jpg")
rows, cols = img.shape[:2]
cfg = "yolov7-tiny.cfg"
weights = "yolov7-tiny.weights"
net = cv.dnn_DetectionModel(cfg, weights)
net.setInputSize(cols, rows)
net.setInputScale(1.0 / 255)
net.setInputSwapRB(True)
with open(className, 'rt') as f:
names = f.read().rstrip('\n').split('\n')
classes, confidences, boxes = net.detect(img, confThreshold=0.25, nmsThreshold=0.4)
print("object count: {}".format(len(boxes))) Output:
|
Thank you very much for sharing, can you provide a tool to convert the pytorch weights of the WongKinYiu/yolov7 into cfg, weight files |
I love this project, new bee!!! |
@AlexeyAB What device was the result generated on? |
Hey @AlexeyAB, I wanted to compare map scores between yolov4 and yolov7 on the coco2017 validation set. I calculated map for yolov4 using I see a huge difference in map scores between yolov4 and yolov7. Is this expected? Or am I doing something wrong? |
cfg: https://raw.githubusercontent.com/AlexeyAB/darknet/master/cfg/yolov7.cfg those download link is not available anymore ,any one can download it? |
they work for me. |
QQ:1027663760 |
C++ please! ;) |
Hi @AlexeyAB, I have a trained model I trained with a custom data set in Pytorch but now need it in Darkent format. You mentioned
How easy is it to convert my weights into Darkent format? If so, how? Or would it be best to train again using Darknet? Thanks, |
I ran quick experiments to compare YOLOv4 and v7 performance. From what I can tell, v7 is slower and less accurate then v4. Anybody else see similar results? |
For me the performance is the same (or similar enough it's not noticeable), but the accuracy is notably worse. I made early comparisons when it was released, and I was mocked for pointing out it was worse when tested in a real-world scenario. 🤣 Either way, don't bother with v5, v7 or v8. They all have the same problem. |
This is what I reported last year as well: https://www.youtube.com/watch?v=JSgDs0XXz8M |
I do agree with @vsaw @invo-mwiseman and @stephanecharette. Especially in industrial real-life use cases, I lost quite some time trying to upgrade to "newer" architectures. The performance of Scaled-yolov4 remains unbeaten. My best guess is that new versions like v7 are somewhat finetuned to benchmark datasets like COCO on an architectual level and not so well suited for general use-cases. Would love to get some more scientific in depth insights into this, since those findings are counterintuitive.... |
Official YOLOv7: Trainable bag-of-freebies sets new state-of-the-art for real-time object detectors
paper: https://arxiv.org/abs/2207.02696
source code - Pytorch (use to reproduce results): https://github.com/WongKinYiu/yolov7
darknet_ros: https://github.com/Ar-Ray-code/darknet_ros_fp16
YOLOv7:
YOLOv7x:
YOLOv7-tiny-leaky-relu:
Darknet cfg/weights file - currently tested for inference only:
Test FPS:
without NMS:
darknet.exe detector demo cfg/coco.data cfg/yolov7-tiny.cfg yolov7-tiny.weights test.mp4 -benchmark
with NMS:
darknet.exe detector demo cfg/coco.data cfg/yolov7-tiny.cfg yolov7-tiny.weights test.mp4 -dont_show
YOLOv7 is more accurate and faster than YOLOv5 by 120% FPS, than YOLOX by 180% FPS, than Dual-Swin-T by 1200% FPS, than ConvNext by 550% FPS, than SWIN-L by 500% FPS, than PPYOLOE-X by 150% FPS.
YOLOv7 surpasses all known object detectors in both speed and accuracy in the range from 5 FPS to 160 FPS and has the highest accuracy 56.8% AP among all known real-time object detectors with 30 FPS or higher on GPU V100, batch=1.
+500%
FPS faster than SWIN-L C-M-RCNN (53.9% AP, 9.2 FPS A100 b=1)+550%
FPS faster than ConvNeXt-XL C-M-RCNN (55.2% AP, 8.6 FPS A100 b=1)+120%
FPS faster than YOLOv5-X6-r6.1 (55.0% AP, 38 FPS V100 b=1)+1200%
FPS faster than Dual-Swin-T C-M-RCNN (53.6% AP, 6.5 FPS V100 b=1)+150%
FPS faster than PPYOLOE-X (51.9% AP, 45 FPS V100 b=1)+180%
FPS faster than YOLOX-X (51.1% AP, 58 FPS V100 b=1)The text was updated successfully, but these errors were encountered: