mirror of https://github.com/alibaba/EasyCV.git
Add stdc benchmark & fix mask2former predict bug (#286)
* add stdc benchmark & fix mask2former predict bugpull/287/head
parent
26cd12ab42
commit
39ae31d50b
|
@ -20,6 +20,7 @@ trained on **Cityscapes**.
|
|||
| Algorithm | Config | Params<br/>(backbone/total) | Train memory<br/>(GB) | inference time(V100)<br/>(ms/img) | mIoU | Download |
|
||||
| ---------- | ------------------------------------------------------------ | ------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ |
|
||||
| STDC1 | [stdc1_cityscape_8xb6_e1290](https://github.com/alibaba/EasyCV/tree/master/configs/segmentation/stdc/stdc1_cityscape_8xb6_e1290.py) | 7.7M/8.5M | 4.5 | 11.9ms | 75.4 | [model](http://pai-vision-data-hz.oss-cn-zhangjiakou.aliyuncs.com/EasyCV/modelzoo/segmentation/stdc/stdc1_cityscapes/epoch_1250.pth) - [log](http://pai-vision-data-hz.oss-cn-zhangjiakou.aliyuncs.com/EasyCV/modelzoo/segmentation/stdc/stdc1_cityscapes/20230214_173123.log.json) |
|
||||
| STDC2 | [stdc2_cityscape_8xb6_e1290](https://github.com/alibaba/EasyCV/tree/master/configs/segmentation/stdc/stdc2_cityscape_8xb6_e1290.py) | 11.6M/12.6M | 5.6 | 15.4ms | 76.6 | [model](http://pai-vision-data-hz.oss-cn-zhangjiakou.aliyuncs.com/EasyCV/modelzoo/segmentation/stdc/stdc2_cityscapes/epoch_1280.pth) - [log](http://pai-vision-data-hz.oss-cn-zhangjiakou.aliyuncs.com/EasyCV/modelzoo/segmentation/stdc/stdc2_cityscapes/20230216_110522.log.json) |
|
||||
|
||||
## Mask2former
|
||||
|
||||
|
|
|
@ -229,9 +229,11 @@ class Mask2formerPredictor(SegmentationPredictor):
|
|||
outputs = self.model.forward(**inputs, mode='test', encode=False)
|
||||
return outputs
|
||||
|
||||
def show_panoptic(self, img, masks, labels):
|
||||
def show_panoptic(self, img, masks, labels_ids, **kwargs):
|
||||
palette = np.asarray(self.cfg.PALETTE)
|
||||
palette = palette[labels % 1000]
|
||||
# ids have already convert to label in process_single function
|
||||
# palette = palette[labels_ids % 1000]
|
||||
palette = palette[labels_ids]
|
||||
panoptic_result = draw_masks(img, masks, palette)
|
||||
return panoptic_result
|
||||
|
||||
|
|
|
@ -145,10 +145,7 @@ class Mask2formerPredictorTest(unittest.TestCase):
|
|||
predict_out[0]['labels_ids'].tolist(),
|
||||
[71, 69, 39, 39, 39, 128, 127, 122, 118, 115, 111, 104, 84, 83])
|
||||
|
||||
pan_img = predictor.show_panoptic(
|
||||
img,
|
||||
masks=predict_out[0]['masks'],
|
||||
labels=predict_out[0]['labels_ids'])
|
||||
pan_img = predictor.show_panoptic(img, **predict_out[0])
|
||||
cv2.imwrite('pan_out.jpg', pan_img)
|
||||
|
||||
def test_panoptic_batch(self):
|
||||
|
@ -168,10 +165,7 @@ class Mask2formerPredictorTest(unittest.TestCase):
|
|||
self.assertListEqual(predict_out[i]['labels_ids'].tolist(), [
|
||||
71, 69, 39, 39, 39, 128, 127, 122, 118, 115, 111, 104, 84, 83
|
||||
])
|
||||
pan_img = predictor.show_panoptic(
|
||||
img,
|
||||
masks=predict_out[i]['masks'],
|
||||
labels=predict_out[i]['labels_ids'])
|
||||
pan_img = predictor.show_panoptic(img, **predict_out[i])
|
||||
cv2.imwrite(save_name, pan_img)
|
||||
|
||||
def test_instance_single(self):
|
||||
|
|
Loading…
Reference in New Issue