label-studio-ml-backend
label-studio-ml-backend copied to clipboard
[mmdetection3] "label not found in project config"
Hi, I recently updated to mmdetection3 and I've been able to get bbox detections using label-studio-ml but none of the bboxes are appearing in the label-studio UI.
Here's the outputs of model_results:
Note that there is only one label balloon and I have tried aliasing using <Label value="balloon" predicted_values="b"/> in the label-studio settings
>>> model_results: <InstanceData(
META INFORMATION
DATA FIELDS
labels: tensor([0])
bboxes: tensor([[9.6121e-01, 2.4110e+02, 1.4343e+02, 5.5810e+02]])
scores: tensor([0.9919])
) at 0x27cd3c3a280>
>>> label_map {'b': 'balloon'}
>>> self.model.dataset_meta: {'classes': 'balloon', 'palette': [(220, 20, 60), (119, 11, 32), (0, 0, 142), (0, 0, 230), (106, 0, 228), (0, 60, 100), (0, 80, 100), (0, 0, 70), (0, 0, 192), (250, 170, 30), (100, 170, 30), (220, 220, 0), (175, 116, 175), (250, 0, 30), (165, 42, 42), (255, 77, 255), (0, 226, 252), (182, 182, 255), (0, 82, 0), (120, 166, 157), (110, 76, 0), (174, 57, 255), (199, 100, 0), (72, 0, 118), (255, 179, 240), (0, 125, 92), (209, 0, 151), (188, 208, 182), (0, 220, 176), (255, 99, 164), (92, 0, 73), (133, 129, 255), (78, 180, 255), (0, 228, 0), (174, 255, 243), (45, 89, 255), (134, 134, 103), (145, 148, 174), (255, 208, 186), (197, 226, 255), (171, 134, 1), (109, 63, 54), (207, 138, 255), (151, 0, 95), (9, 80, 61), (84, 105, 51), (74, 65, 105), (166, 196, 102), (208, 195, 210), (255, 109, 65), (0, 143, 149), (179, 0, 194), (209, 99, 106), (5, 121, 0), (227, 255, 205), (147, 186, 208), (153, 69, 1), (3, 95, 161), (163, 255, 0), (119, 0, 170), (0, 182, 199), (0, 165, 120), (183, 130, 88), (95, 32, 0), (130, 114, 135), (110, 129, 133), (166, 74, 118), (219, 142, 185), (79, 210, 114), (178, 90, 62), (65, 70, 15), (127, 167, 115), (59, 105, 106), (142, 108, 45), (196, 172, 0), (95, 54, 80), (128, 76, 255), (201, 57, 1), (246, 0, 122), (191, 162, 208)]}
Classes >>> balloon
item >>>>> <InstanceData(
META INFORMATION
DATA FIELDS
labels: tensor([0])
bboxes: tensor([[ 0.9612, 241.0995, 143.4349, 558.1034]])
scores: tensor([0.9919])
) at 0x27cc7826b80>
bboxes >>>>> tensor([[ 0.9612, 241.0995, 143.4349, 558.1034]])
label >>>>> tensor([0])
>>> output_label: b
b label not found in project config.
item >>>>>
) at 0x27cd765c430>
>>> RESULTS: []
[2023-05-16 18:00:52,728] [INFO] [werkzeug::_log::225] 192.168.50.151 - - [16/May/2023 18:00:52] "POST /predict HTTP/1.1" 200 -
Fixed by editing the section in lines 102:114 of: label_studio_ml/examples/mmdetection-3/mmdetection.py
classes = [self.model.dataset_meta.get('classes')]
print(f"Classes >>> {classes}")
for item in model_results:
print(f"item >>>>> {item}")
bboxes, label, scores = item['bboxes'], item['labels'], item['scores']
score = float(scores[-1])
if score < self.score_thresh:
continue
print(f"bboxes >>>>> {bboxes}")
label = classes[int(label)]
print(f"label >>>>> {label}")
output_label = self.label_map.get(label, label)
print(f">>> output_label: {output_label}")