-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Issues exporting custom model #1866
Comments
👋 Hello @HampusAstrom, thank you for your interest in YOLOv3 🚀! Please visit our ⭐️ Tutorials to get started, where you can find quickstart guides for simple tasks like Custom Data Training all the way to advanced concepts like Hyperparameter Evolution. If this is a 🐛 Bug Report, please provide screenshots and minimum viable code to reproduce your issue, otherwise we can not help you. If this is a custom training ❓ Question, please provide as much information as possible, including dataset images, training logs, screenshots, and a public link to online W&B logging if available. For business inquiries or professional support requests please visit https://ultralytics.com or email Glenn Jocher at glenn.jocher@ultralytics.com. RequirementsPython>=3.6.0 with all requirements.txt installed including PyTorch>=1.7. To get started: $ git clone https://github.com/ultralytics/yolov3
$ cd yolov3
$ pip install -r requirements.txt EnvironmentsYOLOv3 may be run in any of the following up-to-date verified environments (with all dependencies including CUDA/CUDNN, Python and PyTorch preinstalled):
StatusIf this badge is green, all YOLOv3 GitHub Actions Continuous Integration (CI) tests are currently passing. CI tests verify correct operation of YOLOv3 training (train.py), validation (val.py), inference (detect.py) and export (export.py) on MacOS, Windows, and Ubuntu every 24 hours and on every commit. |
@HampusAstrom your torch or onnx or both dependencies are outdated. |
Thanks for the quick reply. Onnx was at latest python version, but I managed to get it to export by lowering the opset slightly. This however made me realize that this might not be the best solution for my usecase anyway. My situation is this: I need object detection as a first stage in my pipeline, and your repo was great for training such a custom detector. I now want to combine that detector with our pose estimator (https://github.com/shbe-aau/multi-pose-estimation) in a (preferably slim) version. So I only need preprocessing and inference versions of the networks, that I can build together and pass cutouts of the image from each bbox to my code. What would be the best solution for how to import your code for such a scenario? Do I get the preprocessing that the model expects with onnx? I tried importing with torch.hub (custom, local) but ran into issues that seem to be due to your costom hub code breaking if not calling it in your repos folder (not finding models.yolo, looking in my utils folder in m repo rather than in yours et.c.). Calling torch.hub when located in your repo works fine with my custom trained model (and weights). How can I import the model I trained with your code in another repo? Sorry if anything is unclear, I have not used torch.hub before. |
For instance if I try to follow them method mentioned here ultralytics/yolov5#22 (comment) I get the following error:
Similar to the issues in ultralytics/yolov5#1181. I do not have the python packages utils installed, but my folder also contains it's own utils package. Maybe I can fix it by renaming my packages but that will of course break my import statements. A solution where torch.hub does not look locally first would be nice. To be clear, this even happens when calling torch.hub with external source, the command I use is: |
👋 Hello, this issue has been automatically marked as stale because it has not had recent activity. Please note it will be closed if no further activity occurs. Access additional YOLOv3 🚀 resources:
Access additional Ultralytics ⚡ resources:
Feel free to inform us of any other issues you discover or feature requests that come to mind in the future. Pull Requests (PRs) are also always welcomed! Thank you for your contributions to YOLOv3 🚀 and Vision AI ⭐! |
@HampusAstrom you're correct, using
By doing this, you can ensure that the YOLOv3 model is correctly situated within your project, addressing the issues you faced with Let me know if you encounter any further issues or need additional assistance. |
Search before asking
Question
I have trained a model using the command
python train.py --img 400 --epochs 100 --data tless-synthetic.yaml --weights yolov3.pt --batch 8
, and this works fine (data was setup correctly and defined in .yaml mentioned above).But now that I try to export the model so in can import it in another repo (repo contrains own utils folder, had trouble importing using torch.hub). When I run the export command
python export.py --data tless-synthetic.yaml --weights runs/train/exp4/weights/best.pt
I get the following error:Do you have any suggestions on how I can get it to export in either TorchScript or ONNX format so I can import it in my other repo without reference issues like with torch.hub?
I am running on Ubuntu 16.
Additional
No response
The text was updated successfully, but these errors were encountered: