Skip to content
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

integrate yolo as ML backend into my label tasks #6825

Open
JasonSloan opened this issue Dec 25, 2024 · 4 comments
Open

integrate yolo as ML backend into my label tasks #6825

JasonSloan opened this issue Dec 25, 2024 · 4 comments

Comments

@JasonSloan
Copy link

Hi, i tried to integrate the ML models into my label tasks, everything seemd to work fine but no predictions showed though.

Env: label-studio was running in a docker container while the ML-backend was running in the container of the container, but i checked the ENV variable as well as the mapping directory inside the ML-backend container and they were all correctly set.

Tests: I tested in my web browser of the connection between label-studio and ML-backend and it worked fine.
image

Model weight: I put an official yolov8m.pt file downloaded from github into the models folder and i checked inside the ML-backend container that it was really being there.
image

Settings: I set the label template to yolo and wrote the configurations code below:
<View> <Image name="image" value="$image"/> <RectangleLabels name="label" toName="image" model_score_threshold="0.25" model_path="[yolov8n.pt](http://yolov8n.pt/)" opacity="0.1"> <Label value="Person" background="red"/> <Label value="person" background="red"/> <Label value="Car" background="blue"/> </RectangleLabels> </View>

Finally, i checked the images inside the project but no person bounding boxes were shown. Besides, I was pretty sure that the yolov8m.pt can successfully detected them.

So would you please tell me that where i was doing wrong?

@makseq
Copy link
Member

makseq commented Dec 29, 2024

Hi,

  1. This line looks wrong in your labeling config
 model_path="[yolov8n.pt](http://yolov8n.pt/)"

it should be

model_path="yolov8n.pt"
  1. You don't need to download official models manually, they will be downloaded automatically.
  2. Most likely, you didn't specify LABEL_STUDIO_URL and LABEL_STUDIO_API_KEY in the docker-compose.yml file.
  3. Check ML backend logs, the problem should be mentioned there.

@JasonSloan
Copy link
Author

Hi,

  1. This line looks wrong in your labeling config
 model_path="[yolov8n.pt](http://yolov8n.pt/)"

it should be

model_path="yolov8n.pt"
  1. You don't need to download official models manually, they will be downloaded automatically.
  2. Most likely, you didn't specify LABEL_STUDIO_URL and LABEL_STUDIO_API_KEY in the docker-compose.yml file.
  3. Check ML backend logs, the problem should be mentioned there.

Thanks for your reply.

  1. The first problem originated from github not label-studio, i pasted the model_path just like above you mentioned, but github added some extra information to it. So its not a problem

  2. I also tried not to downloaded official models and still failed though.

  3. I have set LABEL_STUDIO_URL as well as LABEL_STUDIO_API_KEY. Because of the reasons we all know of china network, i cant connect to docker-hub freely. So i started ml-backend manually with docker command instead of docker-compose below. And also set LABEL_STUDIO_API_KEY inside the running docker container.

ml-backend starting docker command(followed by docker-compose.yml):
docker run -d --name yolo -p 9090:9090 -e BASIC_AUTH_USER= -e BASIC_AUTH_PASS= -e LOG_LEVEL=DEBUG -e WORKERS=1 -e THREADS=8 -e MODEL_DIR=/data/models -e PYTHONPATH=/app -e LABEL_STUDIO_URL=http://host.docker.internal:8080 -e LABEL_STUDIO_API_KEY= -e ALLOW_CUSTOM_MODEL_PATH=true -e DEBUG_PLOT=false -e MODEL_SCORE_THRESHOLD=0.5 -e MODEL_ROOT=/app/models -v $(pwd)/data/server:/data -v $(pwd)/models:/app/models -v $(pwd)/cache_dir:/app/cache_dir humansignal/yolo:v0
Also the echo result of LABEL_STUDIO_API_KEY inside ml-backend docker container:
image

  1. Can you give me more details on how to get logs in the terminal because of the reason in term 3?

@JasonSloan
Copy link
Author

Hi,

  1. This line looks wrong in your labeling config
 model_path="[yolov8n.pt](http://yolov8n.pt/)"

it should be

model_path="yolov8n.pt"
  1. You don't need to download official models manually, they will be downloaded automatically.
  2. Most likely, you didn't specify LABEL_STUDIO_URL and LABEL_STUDIO_API_KEY in the docker-compose.yml file.
  3. Check ML backend logs, the problem should be mentioned there.

Thanks i have found the reason why, i should have set LABEL_STUDIO_URL=http://192.168.103.130:8080/ rather than LABEL_STUDIO_URL=host.docker.internal:8080. Now it works!
Thanks a lot for your help!

@JasonSloan JasonSloan reopened this Jan 6, 2025
@JasonSloan
Copy link
Author

Sorry, another problem occured. I have to reopen this issue.
Now yolov8 worked well as i could see the boxes predicted by it while yolov11 failed.
I checked the logs and it told me that "Can't get attribute 'C3k2' on <module 'ultralytics.nn.modules.block' from '/opt/conda/lib/python3.10/site-packages/ultralytics/nn/modules/block.py'>".
I tried to import C3k2 in ML-backend env and it seemed that the C3k2 module can be found.
So can you please help me with this?

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants