supervision
supervision copied to clipboard
Mmdetection mask
Description
See #765
List any dependencies that are required for this change.
Type of change
- Bug fix (non-breaking change which fixes an issue)
- New feature (non-breaking change which adds functionality)
How has this change been tested, please provide a testcase or example of how you tested the change?
Try putting in a configuration without a mask and a config with a mask to see if the value fits well
Any specific deployment considerations
Nothing
Docs
There is nothing special
Hi @DrawingProcess 👋🏻 ! Thanks a lot for your interest in supervision. Could you provide an example that we could use to test your changes?
Here is a test code.
First of all, You have to ready for mmdetection Environment Then modify datapath(datset, sub(coco format)) of the below code.
test code
import random
from mmdet.apis import init_detector, inference_detector
import supervision as sv
from mmengine import Config
# without mask model
# cfg = Config.fromfile('checkpoint/rtmdet_s_8xb32-300e_coco.py')
# checkpoint_file = 'checkpoint/rtmdet_s_8xb32-300e_coco_20220905_161602-387a891e.pth'
# with mask model
cfg = Config.fromfile('checkpoint/rtmdet-ins_s_8xb32-300e_coco.py')
checkpoint_file = 'checkpoint/rtmdet-ins_s_8xb32-300e_coco_20221121_212604-fdc5d7ec.pth'
dataset = "/home/avs/dataset/train_exd/"
sub = "EVT_20230715_112856_F_trim"
ds = sv.DetectionDataset.from_coco(
images_directory_path=dataset + sub,
annotations_path=dataset + sub + ".json",
)
images = list(ds.images.values())
model = init_detector(cfg, checkpoint_file)
# image = random.choice(images)
with sv.ImageSink(target_dir_path=f"/home/avs/dataset/train_vis_rtmdet/{sub}", overwrite=True) as sink:
for i, image in enumerate(images):
result = inference_detector(model, image)
detections = sv.Detections.from_mmdetection(result)
print(detections)
Result
without mask model
with mask model
Hi @DrawingProcess 👋🏻 Thank you very much for your contribution! Would it be possible for you to share a Google Colab link for testing purposes?
Establishing a local testing environment could be quite time-consuming, and that time could be more effectively allocated towards developing new features or enhancing our documentation. A Google Colab link would significantly streamline our process, enabling us to integrate this pull request more swiftly.
We greatly appreciate your understanding and support in this matter.