Open victorvargass opened 3 years ago
Assuming that you are using custom classes for training (to obtain the weights), then look at core/config.py . You need to change __C.YOLO.CLASSES value to use the path to your custom classes file. Wrong value in this variable is usually what causes failure in array dimension/shape conversion.
Okay thanks! I changed __C.YOLO.CLASSES to my .names path file and I could effectively generate the weights in tensorflow, but... when I run detect.py or detect_video.py there no detections at all, why?
did you start the training with the "default"/"base" weights from Yolov4 as explained at: https://github.com/AlexeyAB/darknet#how-to-train-to-detect-your-custom-objects ? If not then you need to retrain by using the "base" weights (either yolov4.conv.137 or yolov4-tiny.conv.29), because the training step is basically "transfer learning".
If you've followed Alexey's guide then I'm at a loss as to what exactly happened because in my case it works perfectly. Well, I still need to do some tuning, but for basic custom object detection and tracking, it works.
Yeah, I did the training like Alexey's repo said (with yolov4.conv.137) Did you try with a different .cfg from original yolov4.cfg file? This zip contains original yolov4 and my cfg files... maybe the different masks or anchors make the difference...
Yeah, I did the training like Alexey's repo said (with yolov4.conv.137) Did you try with a different .cfg from original yolov4.cfg file? This zip contains original yolov4 and my cfg files... maybe the different masks or anchors make the difference...
Yes, I modified the cfg files (both tiny and full model cfg) according to the README file (how to train custom objects section), but I didn't make changes to either masks or anchors setting. I only change settings related to the classes or other that's derived from it and also activated random flag for training.
Yes, I just did another training with the AlexeyAB repository and the detections worked fine, except for the size of the Bounding Boxes, I imagine it is because I used other anchors, is there a way to use custom anchors?
Yes, I just did another training with the AlexeyAB repository and the detections worked fine, except for the size of the Bounding Boxes, I imagine it is because I used other anchors, is there a way to use custom anchors?
in my experience, one of the factor that determines the size of the bounding box is how the data is labeled. I've had similar problem before where the size of the bounding boxes fluctuates in a very wide range (up to 2 times the object size). I traced it back to badly labeled datasets--where the labeling is waaay outside of the object to be detected (it was labeled by another team). Once I fixed the labeling, everything went back to normal. Well, after all machine learning is GIGO (garbage in garbage out), if it's fed with "garbage" training datasets, what comes out is "garbage" as well.
Yeah, I understand what you say, but I think the problem is due to the anchors, because with the same weight file, in other codes, even in Alexey AB's detector, the bounding boxes work fine
No, it was not my dataset's fault, I effectively trained with the original yolov4.cfg anchors, converted the weights and it worked fine, with correct Bounding Boxes...:D thank you anyway!
In other hand, I want to edit the count function for a global counting for any class, have you done something like that?
@victorvargass hi !I also encountered the same problem as you, when I use own weights and run detect.py or detect_video.py there no detections at all.What codes have you changed to solve this problem.
@victorvargass hi !I also encountered the same problem as you, when I use own weights and run detect.py or detect_video.py there no detections at all.What codes have you changed to solve this problem.
What anchors did you use in your training .cfg file?, if you used the generated custom anchors by calculate_anchors.py script by AlexeyAB, you will have the same problems than me.
For this yolov4-deepsort repo, you have to re-train your model with yolov4 original anchors (without any change of that): https://github.com/AlexeyAB/darknet/blob/master/cfg/yolov4.cfg#L967 anchors = 12, 16, 19, 36, 40, 28, 36, 75, 76, 55, 72, 146, 142, 110, 192, 243, 459, 401
I use the original anchors to train my model(yolov4-custom.cfg), but nothing can be detected. But AlexeyAB detections worked well.
I use the original anchors to train my model(yolov4-custom.cfg), but nothing can be detected. But AlexeyAB detections worked well.
Can you upload your yolov4-custom.cfg file?
that is my cfg file: https://github.com/ronger-git/darknet/blob/master/cfg/yolov4-ship.cfg I only modified the 'classes','filters','max_batches' and 'steps' from original yolov4-custom.cfg files: https://github.com/AlexeyAB/darknet/blob/master/cfg/yolov4-custom.cfg
Did you define your _--inputsize flag when you run save_model.py? How did you run this script?
I did not modify the input_size. I only modify the path of weights and output.Then use 'python save_model.py --model yolov4' to run.
I did not modify the input_size. I only modify the path of weights and output.Then use 'python save_model.py --model yolov4' to run.
But you must specify the --input-size flag cause the Yolov4 input size default value is 416 but you trained your model with an input size of 608 (is in your .cfg file).
So to save your model correctly you have to run this:
python save_model.py --weights weights_path --output output_weights_path --input_size 608 --model yolov4
And then to run the detecctions: python detect.py --weights output_weights_path --size 608 --model yolov4 --images image_path
我没有修改input_size。 我只修改权重和输出的路径,然后使用'python save_model.py --model yolov4'运行。
但是您必须指定--input-size标志,因为Yolov4输入大小的默认值为416,但是您使用608的输入大小来训练模型(位于.cfg文件中)。
因此,要正确保存模型,您必须运行以下命令:
python save_model.py --weights weights_path-输出output_weights_path --input_size 608 --model yolov4
然后运行检测: python detect.py --weights output_weights_path --size 608 --model yolov4 --images image_path
I did as you said, but still no targets were detected. I can't find the reason. By the way, is it correct that there is nothing in the 'assert' folder of the saved model?
Hi all! I also trained YOLO v4 on the custom data. It's detecting for detection but for deep sort, after converting, when I run objecting tracking.py,
python object_tracker.py --video ./data/video/test.mp4 --weights ./checkpoints/my_custom_yolov4-416 --size 416 --model yolov4 --tiny False --video './data/video/video3.mp4
I am getting nothing. Anyone can help.........
Did you changed the anchors or masks the from cfg file when you trained your Yolov4 model?
Did you changed the anchors or masks the from cfg file when you trained your Yolov4 model?
No, I didn't change mask and anchors, but for small object detection, I change the upsampling layer from 2 to 4. I also tried a trained model on custom classes without changing the upsampling layer. again it didn't detect or show anything.
I have trained my own yolov4 model and used those weights, changed coco.name, did all things mentioned in this thread but not able to detect anything when I run tracker. Please help me
If anyone sees this, I was having the same issues. I finally figured out that I had to uncomment Step 3, run it, and then re-run everything again in order to get it to work! hope this helps someone!
I have trained my own yolov4 model and used those weights, changed coco.name, did all things mentioned in this thread but not able to detect anything when I run tracker. Please help me : I hadn't trained enough to make model detect. I am able to detect objects now after training for 10000 batches
I have trained my own yolov4 model and used those weights, changed coco.name, did all things mentioned in this thread but not able to detect anything when I run tracker. Please help me : I hadn't trained enough to make model detect. I am able to detect objects now after training for 10000 batches
Hi @pranavk2050 does the DeepSORT algorithm (i.e. the object tracker algorithm) require that the object detection part be extremely good at its job (i.e. to detect) and so, you had to train it longer?
I have trained my own yolov4 model and used those weights, changed coco.name, did all things mentioned in this thread but not able to detect anything when I run tracker. Please help me : I hadn't trained enough to make model detect. I am able to detect objects now after training for 10000 batches
Hi @pranavk2050 does the DeepSORT algorithm (i.e. the object tracker algorithm) require that the object detection part be extremely good at its job (i.e. to detect) and so, you had to train it longer?
yes..! that's why detection happened after that amount of batches
I have trained my own yolov4 model and used those weights, changed coco.name, did all things mentioned in this thread but not able to detect anything when I run tracker. Please help me : I hadn't trained enough to make model detect. I am able to detect objects now after training for 10000 batches
Hi @pranavk2050 does the DeepSORT algorithm (i.e. the object tracker algorithm) require that the object detection part be extremely good at its job (i.e. to detect) and so, you had to train it longer?
yes..! that's why detection happened after that amount of batches
Hey @pranavk2050, wanted to ask how many training images had you used to train your yolov4 model? And what was the MAP for the object detection (yolov4)?
When I use a different .weights trained from another .cfg Yolov4 configuration file, gives me the following error:
File "save_model.py", line 50, in save_tf utils.load_weights(model, FLAGS.weights, FLAGS.model, FLAGS.tiny) File "/home/redbird/Escritorio/2020/3. CAR-DETECTION/yolov4-custom-functions-master/core/utils.py", line 143, in load_weights conv_weights = conv_weights.reshape(conv_shape).transpose([2, 3, 1, 0]) ValueError: cannot reshape array of size 4604005 into shape (1024,512,3,3)
How can I set a different .cfg to the FLAGS or something like that? Your work is amazing!, and I need to use another configuration for my trained Yolov4 Thank you!