Chien-Hung / DetVisGUI

This is a GUI for easily visualizing detection results .
MIT License
222 stars 31 forks source link

error on custom dataset in coco format. #5

Open genaev opened 3 years ago

genaev commented 3 years ago

I trained the mask_rcnn model and want to visualize the results of the test samples. My data includes two classes and I converted the data to coco format..

cmd line for DetVisGUI: python DetVisGUI/DetVisGUI.py config/mask_rcnn_r50_caffe_fpn_mstrain-poly_1x_fly.py --det_file work_dirs/mask_rcnn_r50_caffe_fpn_mstrain-poly_1x_fly/test.pkl --stage test

I get the following error:

Traceback (most recent call last):
  File "DetVisGUI/DetVisGUI.py", line 1315, in <module>
    vis_tool().run()
  File "DetVisGUI/DetVisGUI.py", line 363, in __init__
    self.info.set('DATASET: {}'.format(self.data_info.dataset))
AttributeError: 'vis_tool' object has no attribute 'data_info'

file mask_rcnn_r50_caffe_fpn_mstrain-poly_1x_fly.py:

_base_ = 'mask_rcnn/mask_rcnn_r50_caffe_fpn_mstrain-poly_1x_coco.py'

model = dict(
    roi_head=dict(
        bbox_head=dict(num_classes=2),
        mask_head=dict(num_classes=2)))

dataset_type = 'COCODataset'
classes = ('male','female',)
data = dict(
    train=dict(
        img_prefix='data/train',
        classes=classes,
        ann_file='data/train/annotations.json'),
    val=dict(
        img_prefix='data/valid',
        classes=classes,
        ann_file='data/valid/annotations.json'),
    test=dict(
        img_prefix='data/test',
        classes=classes,
        ann_file='data/test/annotations.json'))
Chien-Hung commented 3 years ago

Hi, you can try to use "CocoDataset" as dataset_type instead of "COCODataset" in your config file. If there is still error, please let me know. Thanks.

pixx1 commented 3 years ago

Hi everyone! I spend some time in this issue, because I ran into the same problem and checked ur solution Chien-Hung. In deed, this did the trick. Would it be a solution to compare the two strings like that: "DetVisGUI.py" Line 360:

if cfg.dataset_type.lower() == 'VOCDataset'.lower():
    self.data_info = VOC_dataset(cfg, self.args)
elif cfg.dataset_type.lower() == 'CocoDataset'.lower():
    self.data_info = COCO_dataset(cfg, self.args)

So the case of the word will not affect the comparing.

BTW thanks for this nice tool! It has saved me a lot of time :slightly_smiling_face: