Closed emirhanKural closed 3 years ago
Please make sure that the mmdet
you use is modified which adding the SunrgbdDataset
,I am afraid you are using the version installed in the environment before
You can check it very easily by
import copy
import os.path as osp
import mmcv
import numpy as np
from .builder import DATASETS
from .custom import CustomDataset
import pdb;pdb.set_trace()
@DATASETS.register_module()
class SunrgbdDataset(CustomDataset):
CLASSES = ('void',
'wall', 'floor', 'cabinet', 'bed', 'chair',
'sofa', 'table', 'door', 'window', 'bookshelf',
'picture', 'counter', 'blinds', 'desk', 'shelves',
'curtain', 'dresser', 'pillow', 'mirror', 'floor_mat',
'clothes', 'ceiling', 'books', 'refridgerator', 'television',
'paper', 'towel', 'shower_curtain', 'box', 'whiteboard',
'person', 'night_stand', 'toilet', 'sink', 'lamp',
'bathtub', 'bag', 'otherstructure', 'otherfurniture', 'otherprop')
def load_annotations(self, ann_file):
cat2label = {k: i for i, k in enumerate(self.CLASSES)}
# load image list from file
image_list = mmcv.load(ann_file)
data_infos = []
# convert annotations to middle format
for image_id in image_list.keys():
filename = f'{self.img_prefix}/{image_id}.jpeg'
height, width = image_list[image_id]["height"], image_list[image_id]["width"]
data_info = dict(filename=f'{image_id}.jpeg', width=width, height=height)
# load annotations
bbox_names = image_list[image_id]["cls_names"]
bboxes = image_list[image_id]["bboxes"]
gt_bboxes = []
gt_labels = []
gt_bboxes_ignore = []
gt_labels_ignore = []
# filter 'DontCare'
for bbox_name, bbox in zip(bbox_names, bboxes):
if bbox_name in cat2label:
gt_labels.append(cat2label[bbox_name])
gt_bboxes.append(bbox)
else:
gt_labels_ignore.append(-1)
gt_bboxes_ignore.append(bbox)
data_anno = dict(
bboxes=np.array(gt_bboxes, dtype=np.float32).reshape(-1, 4),
labels=np.array(gt_labels, dtype=np.int64),
bboxes_ignore=np.array(gt_bboxes_ignore,
dtype=np.float32).reshape(-1, 4),
labels_ignore=np.array(gt_labels_ignore, dtype=np.int64))
data_info.update(ann=data_anno)
data_infos.append(data_info)
return data_infos
then launch the training, if it can not stop at pdb.set_trace()
, we can know you do not launch the modified version
Hi @jshilong ! Thank you for your response ^^
I added pdb.set_trace()
and still got the same error.
It seems you are right about using env mmdet.
So what should I do to use modified version? Should I remove mmdet from env ?
OK I got it ^^ hah.. It worked when I moved train.py file from tools to mmdetection folder...
Thank you for your response again !!!
Feel free to reopen the issue if there is any question
Describe the bug
I have tried to create my own dataset class by following this but I got this error :
SUNRGBDDataset is not in the dataset registry
. I checked out similar issues but there isn't any fixed solution there. Also I added name of the class name in__init__.py
.Second error: Moreover I can run
MMDet_Tutorial.ipynb
by this new class and new dataset. Because of that I couldn't train normal way, I convertedMMDet_Tutorial.ipynb
to a .py file to train dataset in terminal. It is working but I cannot get any log file. It only producedNone.log.json
. I hope it will give weights when epoch raise checkpoint_config.interval but not giving log file made me suspiciousReproduction
SUN RGB-D
Environment
python mmdet/utils/collect_env.py
to collect necessary environment information and paste it here.TorchVision: 0.5.0 OpenCV: 4.5.3 MMCV: 1.3.9 MMCV Compiler: GCC 7.5 MMCV CUDA Compiler: 10.0 MMDetection: 2.14.0+4853ea1
My Customized CLass: mmdet/datasets/sunrgbd.py
My Customized CLass: mmdet/datasets/__init__.py