Label Studio ML Backend using YOLOv7 (https://github.com/yhsmiley/yolov7).
Currently only able to predict. Training has not been incorporated yet.
- Git clone this repository.
git clone https://github.com/tehwenyi/label-studio-backend-yolov7.git
cd label-studio-backend-yolov7/
- Copy your YOLOv7 weights (
.pt
file) into theweights
folder (create it if it doesn't exist) and rename it toweights.pt
.
- Please make sure that your weights have been reparameterised and the state dictionary has been saved. Refer to this link to find out how to reparameterise and save the state dictionary.
-
Copy your YOLOv7 deploy cfg (eg.
cfg/deploy/yolov7.yaml
) into thecfg
folder (create it if it doesn't exist) and rename it tocfg.yaml
. -
Start running the backend with Docker Compose.
docker compose up
Follow the instructions on https://github.com/tehwenyi/label-studio to set up with Docker Compose.
- In the Label Studio UI, open the project that you want to use with your ML backend.
- Make sure that the labels you input in the project correspond exactly to your model's trained labels, otherwise you might get a
No Label
annotation after prediction. - Click Settings > Machine Learning.
- Click Add Model.
- Type a Title for the model and provide type http://server:9090 for the URL for the ML backend.
- (Optional) Type a description.
- (Optional) Select Retrieve predictions when loading a task automatically to allow predictions on all images.
- Click Validate and Save. Instructions adapted from Label Studio Documentation
- For any changes to the YOLOv7 inference parameters, edit the parameters in Line 21 of
backend.py
- The Docker containers are added to the same network
label-studio
. - The YOLOv7 backend uses Python 3.9.
- The YOLOv7 backend uses port
9090
while label studio typically uses8080
. - To find out how to create your own ML backend, refer to heartexlabs/label-studio-ml-backend# label-studio-backend-yolov7