Closed RiyazAina-DeepML closed 4 years ago
Review the loading information. I think you don't modify the num_classes properly.
inside coco.py file i changed the classes to my custom classes,also i changed the classes in custom.py still facing same issue,please help me solve
@DATASETS.register_module() class CocoDataset(CustomDataset):
CLASSES = ('person', 'bicycle', 'car', 'motorcycle', 'airplane', 'bus',
'train', 'truck', 'boat', 'traffic light', 'fire hydrant',
'stop sign', 'parking meter', 'bench', 'bird', 'cat', 'dog',
'horse', 'sheep', 'cow', 'elephant', 'bear', 'zebra', 'giraffe',
'backpack', 'umbrella', 'handbag', 'tie', 'suitcase', 'frisbee',
'skis', 'snowboard', 'sports ball', 'kite', 'baseball bat',
'baseball glove', 'skateboard', 'surfboard', 'tennis racket',
'bottle', 'wine glass', 'cup', 'fork', 'knife', 'spoon', 'bowl',
'banana', 'apple', 'sandwich', 'orange', 'broccoli', 'carrot',
'hot dog', 'pizza', 'donut', 'cake', 'chair', 'couch',
'potted plant', 'bed', 'dining table', 'toilet', 'tv', 'laptop',
'mouse', 'remote', 'keyboard', 'cell phone', 'microwave',
'oven', 'toaster', 'sink', 'refrigerator', 'book', 'clock',
'vase', 'scissors', 'teddy bear', 'hair drier', 'toothbrush')
here i made changes,and also in custom.py
Review the loading information. I think you don't modify the num_classes properly.
this is my coco_detection.py file
dataset_type = 'CocoDataset' data_root = '/home/panick/lab/riyaj/onion_config_model/mmlab_model/' img_norm_cfg = dict( mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True) train_pipeline = [ dict(type='LoadImageFromFile'), dict(type='LoadAnnotations', with_bbox=True), dict(type='Resize', img_scale=(512, 512), keep_ratio=True), dict(type='RandomFlip', flip_ratio=0.5), dict(type='Normalize', **img_norm_cfg), dict(type='Pad', size_divisor=32), dict(type='DefaultFormatBundle'), dict(type='Collect', keys=['img', 'gt_bboxes', 'gt_labels']), ] test_pipeline = [ dict(type='LoadImageFromFile'), dict( type='MultiScaleFlipAug', img_scale=(512, 512), flip=False, transforms=[ dict(type='Resize', keep_ratio=True), dict(type='RandomFlip'), dict(type='Normalize', **img_norm_cfg), dict(type='Pad', size_divisor=32), dict(type='ImageToTensor', keys=['img']), dict(type='Collect', keys=['img']), ]) ] data = dict( samples_per_gpu=2, workers_per_gpu=2, train=dict( type=dataset_type, ann_file=data_root + 'train/train_coco.json', img_prefix=data_root + 'train/images/', pipeline=train_pipeline), val=dict( type=dataset_type, ann_file=data_root + 'val/val_coco.json', img_prefix=data_root + 'val/images/', pipeline=test_pipeline), test=dict( type=dataset_type, ann_file=data_root + 'val/val_coco.jso', img_prefix=data_root + 'val/images/', pipeline=test_pipeline)) evaluation = dict(interval=1, metric='bbox')
I think you forgot to modify 'num_classes' in 'mmdetection/configs/_base-/models/mask_rcnn_r50_fpn.py' You should find out all configs that 'mask_rcnn_r50_fpn_1x_coco.py' based on and modify them properly. It's written at the head of 'mask_rcnn_r50_fpn_1x_coco.py'.
2020-05-12 08:06:39,746 - mmdet - INFO - Start running, host: root@ml-instance-0, work_dir: /home/panick/lab/riyaj/mmlab_model/work_dirs/mask_rcnn_r50_fpn_1x 2020-05-12 08:06:39,746 - mmdet - INFO - workflow: [('train', 1)], max: 12 epochs 2020-05-12 08:07:23,594 - mmdet - INFO - Epoch [1][1/1] lr: 0.00067, eta: 0:08:02, time: 43.843, data_time: 43.150, memory: 4105, loss_rpn_cls: 0.6834, loss_rpn_bbox: 0.0000, loss_cls: 0.6915, acc: 52.4414, loss_bbox: 0.0008, loss_mask: 1.7109, loss: 3.0865 2020-05-12 08:08:08,181 - mmdet - INFO - Epoch [2][1/1] lr: 0.00074, eta: 0:07:17, time: 43.749, data_time: 43.113, memory: 4446, loss_rpn_cls: 0.6820, loss_rpn_bbox: 0.0000, loss_cls: 0.6620, acc: 61.4258, loss_bbox: 0.0003, loss_mask: 1.2877, loss: 2.6320 2020-05-12 08:08:52,764 - mmdet - INFO - Epoch [3][1/1] lr: 0.00081, eta: 0:06:34, time: 43.750, data_time: 43.106, memory: 4446, loss_rpn_cls: 0.6837, loss_rpn_bbox: 0.0000, loss_cls: 0.6391, acc: 80.5664, loss_bbox: 0.0002, loss_mask: 0.9539, loss: 2.2768 2020-05-12 08:09:37,235 - mmdet - INFO - Epoch [4][1/1] lr: 0.00089, eta: 0:05:49, time: 43.636, data_time: 42.997, memory: 4446, loss_rpn_cls: 0.6821, loss_rpn_bbox: 0.0000, loss_cls: 0.5919, acc: 92.6758, loss_bbox: 0.0003, loss_mask: 0.9346, loss: 2.2089
this is how my training going on ,but after inference on same training image i am not getting any output? what is wrong can u help me in this case? because even after changing thresh ,i m not getting anything detected
can u share ur email id ,so i can share my output image
I don't know how to chat with u privately... I think you should firstly check whther the command is right. And you'd better value the model while training it, so you'll know whether it works. In addition, performance in small object detection may be not so good.
... Even if you just want to have a try, I think one image trained 4 epoches is not enough. Get more image with annotations and train more epoches.
i am converting Vgg image annotator json to coco format ,so i have one one question about coco format. in segmentation key what is first co-ordinate ?is it sequence of x and then y or y then x co-ordinate.
this is snippet of coco json segmentation field
{"segmentation": [[1273.0, 2111.0, 1262.0, 2110.0, 1255.0, 2107.0, 1249.0, 2097.0, 1246.0, 2087.0, 1244.0, 2073.0, 1245.0, 2066.0, 1250.0, 2058.0, 1256.0, 2048.0, 1262.0, 2042.0, 1268.0, 2038.0, 1281.0, 2034.0, 1294.0, 2031.0, 1307.0, 2031.0, 1319.0, 2033.0, 1331.0, 2037.0, 1344.0, 2041.0, 1345.0, 2043.0, 1347.0, 2047.0, 1347.0, 2052.0, 1343.0, 2060.0, 1334.0, 2070.0, 1328.0, 2082.0, 1325.0, 2093.0, 1320.0, 2100.0, 1312.0, 2105.0, 1297.0, 2109.0]], "iscrowd": 0, "area": 3509871, "image_id": 26, "bbox": [1244.0, 2031.0, 103.0, 79.0], "category_id": 1, "id": 27},
here what is sequence inside segmentation field? is it x and then y or reverse of this?
please let me know bcz yet i am not getting any detectioin
This tutorial gives examples to set classes in datasets without modifying the code.
@ZwwWayne the url you gave does not work, do you have the updated url?
another closed issue also has the same 404 to a tutorial. a tutorial would be very helpful.
when i am running python3 tools/train.py mmdetection/configs/mask_rcnn/mask_rcnn_r50_fpn_1x_coco.py
i am getting this following error ,please help to solve this issue i am new to mmlab
File "/usr/local/lib/python3.6/dist-packages/mmdet-2.0.0+514a644-py3.6-linux-x86_64.egg/mmdet/apis/train.py", line 165, in train_detector runner.run(data_loaders, cfg.workflow, cfg.total_epochs) File "/usr/local/lib/python3.6/dist-packages/mmcv/runner/runner.py", line 383, in run epoch_runner(data_loaders[i], kwargs) File "/usr/local/lib/python3.6/dist-packages/mmcv/runner/runner.py", line 292, in train self.call_hook('after_train_epoch') File "/usr/local/lib/python3.6/dist-packages/mmcv/runner/runner.py", line 245, in call_hook getattr(hook, fn_name)(self) File "/usr/local/lib/python3.6/dist-packages/mmdet-2.0.0+514a644-py3.6-linux-x86_64.egg/mmdet/core/evaluation/eval_hooks.py", line 28, in after_train_epoch self.evaluate(runner, results) File "/usr/local/lib/python3.6/dist-packages/mmdet-2.0.0+514a644-py3.6-linux-x86_64.egg/mmdet/core/evaluation/eval_hooks.py", line 32, in evaluate results, logger=runner.logger, self.eval_kwargs) File "/usr/local/lib/python3.6/dist-packages/mmdet-2.0.0+514a644-py3.6-linux-x86_64.egg/mmdet/datasets/coco.py", line 349, in evaluate result_files, tmp_dir = self.format_results(results, jsonfile_prefix) File "/usr/local/lib/python3.6/dist-packages/mmdet-2.0.0+514a644-py3.6-linux-x86_64.egg/mmdet/datasets/coco.py", line 310, in format_results result_files = self.results2json(results, jsonfile_prefix) File "/usr/local/lib/python3.6/dist-packages/mmdet-2.0.0+514a644-py3.6-linux-x86_64.egg/mmdet/datasets/coco.py", line 248, in results2json json_results = self._segm2json(results) File "/usr/local/lib/python3.6/dist-packages/mmdet-2.0.0+514a644-py3.6-linux-x86_64.egg/mmdet/datasets/coco.py", line 199, in _segm2json data['category_id'] = self.cat_ids[label] IndexError: list index out of range