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
Load my own Yolov5 model on cvat by nuclio (function.yaml) #4909
Comments
Self-solved. There is no information on internet for the particular case on nuclio yolo model for auto trainning further than the example with the yolo default model so I hope this is helping someone. On main the loading model configuration must be changed this way: torch.model.load(, 'custom', path=/best.pt, force_reload=True) is the correct sentence for a custom model. All other configurations could generate error on function deploy. I close the issue. |
hey, I am currently trying to load my local model file during the model deployment through editing YAML file with kind: COPY. But it seems that the system cannot find the local file. Just wonder how you make it. |
I would need more information about your case. What I did where to load my model for auto-annotation on CVAT getting the repository on an Ubuntu virtualization by WSL on Windows using a Docker container to deploy on nuclio and finally auto-annotate on CVAT. My model where YoloV5 model on pytorch. I put some instructions bellow in order to help you or someone with my problem with the same purpose. If this is your specific case or you are deploying some other nuclio function it's all about routes. At main.py there is a sentence torch..hub.load() with wrong arguments (wrong for your model) so use ultralytics/yolov5 repo at first argument (this one lets you use some repo scripts which are necessary), 'custom' as a seccond argument and third argument the path you can find at localhost:8070 on nuclio interface where you have to save your weights (best.pt). To get this last one deploy the yolo default as said on cvat auto-annotation and navigate to find the route, but is usually the common folder inside serverless at repo (you will find something like opt/common). The last argument force_reload is optional. In main.py: model = torch.hub.load('ultralyics/yolov5', 'custom', path='common/best.pt', force_reload=True) |
Hi, I also needed to create a model with my parameters, but unfortunately it did not work.
After loading the model my tag is missing in the labels and the following error occurs:
How do I fix this? I followed the documentation, but I must have made a mistake somewhere... |
Please tell me what steps you took to create a custom model? |
I experience the same issue getting this error when running the build in yolov5 detector:
|
@halskov @nfrvnikita Even I am facing the same problem. Did you find any solution for it ? |
I gave up and ended up running detect.py locally on the images, then uploading the annotations manually to completely avoid the Nuclio integration. |
Hey, maybe it is still an issue for you. I haven't tried this yet, but I am able to use custom models which are not yolo models. In this linked issue, it is described how to load custom weights to your custom yolo model You need to modify the main.py file in your custom nuclio dir to load the weights, If I understood correctly. |
I haven't looked into this since then as my current workflow of doing the detection locally and then uploading runs smoothly. |
My actions before raising this issue
The problem starts when deploying the model to nuclio in order to use it at cvat.
I have a trained model by yolo v5 (its weights best.pt file) and from that model I want to auto annotate (which is in fact the purpose of cvat). The thing is the official tutorial pasted above shows how to do it with a detectron2 model. For yolo there's an example on the cvat folder at serverless/ultralytics/yolo that I already loaded and worked. Seems easy right?
I copied the yolov5 folder to use from start to load mine. I start so from function.yaml and main.py at the copied folder inside nuclio folder and the thing is how to modify that files to get my own model instead of the standard yolo model which is actually using that.
Expected Behaviour
The model should be loaded to nuclio after running on my wsl ubuntu the command ./serverless/deploy_cpu.sh ./serverless/pytorch/ultralytics/yolov5-copy
Current Behaviour
Executor failed running [/bin/sh -c pip install nuclio-sdk msgpack --no-index --find-links /opt/nuclio/whl]: exit code 127
Also exit code 1 sometimes the error shown deppends on changes made to function.yaml or main.py.
Possible Solution
Surely function.yaml and main.py must be changed to fit with my own trained model (my weights best.pt file) but seems not so easy after a lot of tries and there's no information on internet about how to modify that file. Probably base:Image should be changed on function... I don't know, I've been trying and there's no way
Steps to Reproduce (for bugs)
1-Simply install cvat repo from cvat and install auto annotation tools by nuclio. (All this on Ubuntu 18.04 WSL on Windows)
2-Deploy a custom YOLOv5 model (not the default one).
Context
Impossible to deploy my own YOLOv5 dataset to nuclio serverless as function. Impossible to auto-annotate.
Your Environment
Ubuntu on WSL 18.04 on Windows.
Docker version : latest.
Other diagnostic information / logs:
Console exit code 127 or exit code 1 provocated by incorrect changes on function.yaml and main.py, the problem is in that files.
The text was updated successfully, but these errors were encountered: