Blog
Blog
How to Train Detectron2 for Custom Instance Segmentation
How to train Detectron2 to segment your custom objects from any image by providing our model with example training data.
YOLOv7 was created by WongKinYiu and AlexeyAB, the creators of YOLOv4 Darknet (and the official canonical maintainers of the YOLO lineage according to pjreddie, the original inventor and maintainer of the YOLO architecture).
![YOLOv7 Instance Segmentation example](https://github.com/WongKinYiu/yolov7/blob/main)
YOLOv7 for instance segmentation (YOLOR + YOLOv5 + YOLACT)
Model: YOLOv7-seg
Test Size: 640
APbox: 51.4%
AP50box: 69.4%
AP75box: 55.8%
APmask: 41.5%
AP50mask: 65.5%
AP75mask: 43.7%
You can run fine-tuned YOLOv7 instance segmentation models with Inference.
First, install Inference:
pip install inference
Retrieve your Roboflow API key and save it in an environment variable called ROBOFLOW_API_KEY
:
export ROBOFLOW_API_KEY="your-api-key"
To use your model, run the following code:
import inference
model = inference.load_roboflow_model("model-name/version")
results = model.infer(image="YOUR_IMAGE.jpg")
Above, replace:
YOUR_IMAGE.jpg
with the path to your image.model_id/version
with the YOLOv7 model ID and version you want to use. Learn how to retrieve your model and version ID