CVHub520 / X-AnyLabeling

Effortless data labeling with AI support from Segment Anything and other awesome models.
GNU General Public License v3.0
4.22k stars 484 forks source link

Custom class labeling #696

Closed imdsafi09 closed 2 weeks ago

imdsafi09 commented 4 weeks ago

Search before asking

Question

Hi, First of all, thank you for open-sourcing this great tool. I want to ask if there is any way to customize the detection of the classes (apart from using a custom model). For instance, I am labeling for person detection, but after inference, the model (yolov8x) is outputting all the COCO classes, which I have to remove individually. I would appreciate it if you could give me any solutions or suggestions.

Additional

No response

CVHub520 commented 4 weeks ago

Hi @imdsafi09,

You can customize which classes are detected during inference by using the filter_classes parameter in your configuration. Since you only want to detect persons, you can specify this in your config file like this:

...
filter_classes:
  - person

This will ensure that the model only outputs person detections, even though it was trained on all COCO classes. The filter_classes parameter acts as a filter during inference time to only keep the classes you're interested in, without requiring any manual removal of other classes.

For example, your full config could look like:

type: yolov8
name: yolov8x-r20230520
display_name: xxx
model_path: https://github.com/CVHub520/X-AnyLabeling/releases/download/v0.1.0/yolov8x.onnx
nms_threshold: 0.45
confidence_threshold: 0.25
filter_classes:
  - person
classes:
  - person
  - bicycle
  - car
  - ...

This way, you won't need to manually remove the other COCO classes after inference - the model will only output person detections.

Let me know if you need any clarification or run into any issues!

imdsafi09 commented 4 weeks ago

I tried, and now it's working fine. Thank you very much.