Hello~
I'm facing the problem of weight conversion
Before the conversion, detect.py works fine and BBox was good.
But, there is no detection(BBox) after using the weight conversion in readme (.pt to .weight)
Does anyone know about it????
Hello, thank you for your interest in our work! This issue seems to lack the minimum requirements for a proper response, or is insufficiently detailed for us to help you. Please note that most technical problems are due to:
git clone version of this repository we can not debug it. Before going further run this code and ensure your issue persists:sudo rm -rf yolov3 # remove existing
git clone https://github.com/ultralytics/yolov3 && cd yolov3 # clone latest
python3 detect.py # verify detection
python3 train.py # verify training (a few batches only)
# CODE TO REPRODUCE YOUR ISSUE HERE
train_batch0.jpg and test_batch0.jpg for a sanity check of training and testing data.If none of these apply to you, we suggest you close this issue and raise a new one using the Bug Report template, providing screenshots and minimum viable code to reproduce your issue. Thank you!
I think I meet the same problem. when converting PyTorch weight '.pt' to darknet '.weights'. I found that in this repo for single class detection, the classification confidence will be assigned as 1 automatically.
if self.nc == 1:
io[..., 5] = 1 # single-class model https://github.com/ultralytics/yolov3/issues/235
But the darknet code would not. So there would be no result for converted.weights run by darknet code. don't know any way to solve except change darknet code.
Same problem here.
I have trained a yolov3-spp net for single class detection with this repo.
Everything work as intended with test.py.
But I get no bounding boxes when exporting as a .weights file.
@yuanyuangoo @TheophileBlard ah yes, for the single class case this makes sense. We do not use or train single-class loss components in this repo, since it is a redundant operation, yet we leave the output there for commonality with multi-class models. For your trained models there is no solution to this. If you retrain you could modify the train and inference code to use classification output.
Inference:
https://github.com/ultralytics/yolov3/blob/84371f68117cae975eabfa78cdf8a2aa1b78e4ba/models.py#L242-L244
@TheophileBlard @yuanyuangoo @R06921096Yen I've made updates now that prebias the class output neurons dependent on the number of training classes. For single class datasets, the neurons are initialized to output 0.99 class confidences, and since we don't train these neurons, they should remain this way through all of training, and then afterward when exporting to darknet format.
If you git pull to get this update, and then retrain, you should be able to successfully export to darknet without issue now!
The updates are here. They affect all models, not just single class models, and should make for more robust training across a variety of datasets.
https://github.com/ultralytics/yolov3/blob/1d45ec84bc95617b36a38ff1ae33a4237df2fa73/models.py#L90-L92
@glenn-jocher @TheophileBlard @yuanyuangoo Thanks for your replies and updates.
I will retrain in a few days.
The updates are here. They affect all models, not just single class models, and should make for more robust training across a variety of datasets.
https://github.com/ultralytics/yolov3/blob/1d45ec84bc95617b36a38ff1ae33a4237df2fa73/models.py#L90-L92
Thanks for your modifications, very appreciated ! I was able to train a new model and convert it to a .weights file successfully. Inference with darknet works ok. However I encountered some new issues:
@TheophileBlard yes the new update always tests at the same 0.001 conf threshold during training as is used independently when running test.py directly. This allows train.py to plot higher mAPs. The precision should be near zero and the recall should be near 1.0 during optimal conditions because it is plotting the end of the P-R curve (mAP is the area under this curve). See https://github.com/ultralytics/yolov3/issues/422#issuecomment-518617951
The other issue should be corrected with a recent commit. I will look into the hyperparameter situation.
@TheophileBlard yes the new update always tests at the same 0.001 conf threshold during training as is used independently when running test.py directly. This allows train.py to plot higher mAPs. The precision should be near zero and the recall should be near 1.0 during optimal conditions because it is plotting the end of the P-R curve (mAP is the area under this curve). See #422 (comment)
The other issue should be corrected with a recent commit. I will look into the hyperparameter situation.
Hi, thanks for the changes and pointers ! As I understand it, https://github.com/ultralytics/yolov3/commit/1dc1761f45fe46f077694e1a70472cd7eb788e0c solves the hyperparameters/evolve issue and https://github.com/ultralytics/yolov3/commit/b8b89a31329da9ba4146493e73f4762abca741e4 the nms one.
Regarding precision, I see your point (by the way the new tutorial #898 is really appreciated). The conf_thresh was changed from 0.1 to 0.001 in https://github.com/ultralytics/yolov3/commit/6ab753a9e7a9c88ff26530ffa23d7350f3bda552, which explains the precision drop when using plot_results() during training.
I understand that there is no impact on the training process, but why would you want to plot "higher mAPs" ? Also, should I keep a low conf_thresh when using the --evolve parameter ? As you explain in #392, hyperparameters are tuned depending on fitness. But if the precision is low, the fitness would not also be abnormally low ?
On my side, this issue can be closed.
@TheophileBlard the correct mAP would be evaluated over every single box, i.e. at --conf 0.0, but this takes a long time, so we compute instead approximations near zero, i.e. --conf 0.001. Thus dropping the conf thresh shows us a more accurate approximation to the true mAP.
You can define your own fitness here:
https://github.com/ultralytics/yolov3/blob/65eeb1bae5ea1f7d7249c0caf581e95de0dc1637/utils/utils.py#L892-L896
Is there any chance I can transfer the pre-trained model with older code to new one compatible to darknet format for single class detection, please?
@yuanyuangoo no, you鈥檇 have to retrain.
Most helpful comment
The updates are here. They affect all models, not just single class models, and should make for more robust training across a variety of datasets.
https://github.com/ultralytics/yolov3/blob/1d45ec84bc95617b36a38ff1ae33a4237df2fa73/models.py#L90-L92