Closed BaeSukkyoung closed 2 years ago
what code did you change? maybe you loss ',' in your code
I changed "class_names.py" under like this.
import mmcv
def wider_face_classes(): return ['face']
def voc_classes(): return [ 'aeroplane', 'bicycle', 'bird', 'boat', 'bottle', 'bus', 'car', 'cat', 'chair', 'cow', 'diningtable', 'dog', 'horse', 'motorbike', 'person', 'pottedplant', 'sheep', 'sofa', 'train', 'tvmonitor' ]
def imagenet_det_classes(): return [ 'accordion', 'airplane', 'ant', 'antelope', 'apple', 'armadillo', 'artichoke', 'axe', 'baby_bed', 'backpack', 'bagel', 'balance_beam', 'banana', 'band_aid', 'banjo', 'baseball', 'basketball', 'bathing_cap', 'beaker', 'bear', 'bee', 'bell_pepper', 'bench', 'bicycle', 'binder', 'bird', 'bookshelf', 'bow_tie', 'bow', 'bowl', 'brassiere', 'burrito', 'bus', 'butterfly', 'camel', 'can_opener', 'car', 'cart', 'cattle', 'cello', 'centipede', 'chain_saw', 'chair', 'chime', 'cocktail_shaker', 'coffee_maker', 'computer_keyboard', 'computer_mouse', 'corkscrew', 'cream', 'croquet_ball', 'crutch', 'cucumber', 'cup_or_mug', 'diaper', 'digital_clock', 'dishwasher', 'dog', 'domestic_cat', 'dragonfly', 'drum', 'dumbbell', 'electric_fan', 'elephant', 'face_powder', 'fig', 'filing_cabinet', 'flower_pot', 'flute', 'fox', 'french_horn', 'frog', 'frying_pan', 'giant_panda', 'goldfish', 'golf_ball', 'golfcart', 'guacamole', 'guitar', 'hair_dryer', 'hair_spray', 'hamburger', 'hammer', 'hamster', 'harmonica', 'harp', 'hat_with_a_wide_brim', 'head_cabbage', 'helmet', 'hippopotamus', 'horizontal_bar', 'horse', 'hotdog', 'iPod', 'isopod', 'jellyfish', 'koala_bear', 'ladle', 'ladybug', 'lamp', 'laptop', 'lemon', 'lion', 'lipstick', 'lizard', 'lobster', 'maillot', 'maraca', 'microphone', 'microwave', 'milk_can', 'miniskirt', 'monkey', 'motorcycle', 'mushroom', 'nail', 'neck_brace', 'oboe', 'orange', 'otter', 'pencil_box', 'pencil_sharpener', 'perfume', 'person', 'piano', 'pineapple', 'ping-pong_ball', 'pitcher', 'pizza', 'plastic_bag', 'plate_rack', 'pomegranate', 'popsicle', 'porcupine', 'power_drill', 'pretzel', 'printer', 'puck', 'punching_bag', 'purse', 'rabbit', 'racket', 'ray', 'red_panda', 'refrigerator', 'remote_control', 'rubber_eraser', 'rugby_ball', 'ruler', 'salt_or_pepper_shaker', 'saxophone', 'scorpion', 'screwdriver', 'seal', 'sheep', 'ski', 'skunk', 'snail', 'snake', 'snowmobile', 'snowplow', 'soap_dispenser', 'soccer_ball', 'sofa', 'spatula', 'squirrel', 'starfish', 'stethoscope', 'stove', 'strainer', 'strawberry', 'stretcher', 'sunglasses', 'swimming_trunks', 'swine', 'syringe', 'table', 'tape_player', 'tennis_ball', 'tick', 'tie', 'tiger', 'toaster', 'traffic_light', 'train', 'trombone', 'trumpet', 'turtle', 'tv_or_monitor', 'unicycle', 'vacuum', 'violin', 'volleyball', 'waffle_iron', 'washer', 'water_bottle', 'watercraft', 'whale', 'wine_bottle', 'zebra' ]
def imagenet_vid_classes(): return [ 'airplane', 'antelope', 'bear', 'bicycle', 'bird', 'bus', 'car', 'cattle', 'dog', 'domestic_cat', 'elephant', 'fox', 'giant_panda', 'hamster', 'horse', 'lion', 'lizard', 'monkey', 'motorcycle', 'rabbit', 'red_panda', 'sheep', 'snake', 'squirrel', 'tiger', 'train', 'turtle', 'watercraft', 'whale', 'zebra' ]
def coco_classes(): return [ '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' ]
def cityscapes_classes(): return [ 'person', 'rider', 'car', 'truck', 'bus', 'train', 'motorcycle', 'bicycle' ]
_def concrete_crackclasses(): return [ 'background', 'crack' ]
dataset_aliases = { 'voc': ['voc', 'pascal_voc', 'voc07', 'voc12'], 'imagenet_det': ['det', 'imagenet_det', 'ilsvrc_det'], 'imagenet_vid': ['vid', 'imagenet_vid', 'ilsvrc_vid'], 'coco': ['coco', 'mscoco', 'ms_coco'], 'wider_face': ['WIDERFaceDataset', 'widerface', 'WIDERFace'], 'cityscapes': ['cityscapes'] **'concrete_crack': ['concretecrack']** }
def get_classes(dataset): """Get class names of a dataset.""" alias2name = {} for name, aliases in dataset_aliases.items(): for alias in aliases: alias2name[alias] = name
if mmcv.is_str(dataset):
if dataset in alias2name:
labels = eval(alias2name[dataset] + '_classes()')
else:
raise ValueError(f'Unrecognized dataset: {dataset}')
else:
raise TypeError(f'dataset must a str, but got {type(dataset)}')
return labels
dataset_aliases = { 'voc': ['voc', 'pascal_voc', 'voc07', 'voc12'], 'imagenet_det': ['det', 'imagenet_det', 'ilsvrc_det'], 'imagenet_vid': ['vid', 'imagenet_vid', 'ilsvrc_vid'], 'coco': ['coco', 'mscoco', 'ms_coco'], 'wider_face': ['WIDERFaceDataset', 'wider_face', 'WIDERFace'], 'cityscapes': ['cityscapes'] 'concrete_crack': ['concrete_crack'] }
you loss ",", you need add a , behind 'cityscapes': ['cityscapes']
After doing what you said, another problem arose under like this.
Traceback (most recent call last):
File "./tools/train.py", line 16, in
File "/home/user/mmdetection/mmdet/apis/inference.py", line 12, in
File "/home/user/mmdetection/mmdet/apis/init.py", line 2, in
from .inference import (async_inference_detector, inference_detector,
File "/home/user/mmdetection/mmdet/apis/inference.py", line 12, in
File "/home/user/mmdetection/mmdet/apis/init.py", line 2, in
File "/home/user/mmdetection/mmdet/datasets/concrete_crack.py", line 2, in
from .concrete_crack import ConcreteCrackModuleNotFoundErrorfrom .concrete_crack import ConcreteCrack File "/home/user/mmdetection/mmdet/apis/inference.py", line 12, in
:
No module named 'mmdet.datasets.registry' File "/home/user/mmdetection/mmdet/datasets/concrete_crack.py", line 2, in
from .registry import DATASETSfrom mmdet.datasets import replace_ImageToTensorfrom .registry import DATASETS
ModuleNotFoundError File "/home/user/mmdetection/mmdet/datasets/init.py", line 17, in
from .registry import DATASETSfrom mmdet.datasets import replace_ImageToTensorfrom .registry import DATASETS
Seems this is a typo error that you write in your code. Also, please check your path
Thx. Then, where can I change the number of epoch ? which script.. I cannot find it.
https://mmdetection.readthedocs.io/en/v2.21.0/tutorials/config.html There some tutorials may help you understand MMDet
Thx. I find and change the epoch then...
'The old API of register_module(module, force=False) ' [>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>] 356/353, 9.0 task/s, elapsed: 40s, ETA: 0s
Traceback (most recent call last):
File "./tools/train.py", line 189, in
I got this error, what does it mean ? It means that my dataset include the object which doesn't need to be detected ?
maybe your num class is not equal to bbox_head.num_class. you need to check your config file
Thanks for your error report and we appreciate it a lot.
Checklist
Describe the bug A clear and concise description of what the bug is.
Reproduction
I run the ./tools/dist_train.sh configs/cascade_mask_rcnn_x101_64x4d_fpn_1x_coco.py 4 .
I make some modifications on the config. 'cascade_mask_rcnn_x101_64x4d_fpn_1x_coco' for concrete crack dataset.
I used my own dataset about concrete crack. I also made concrete_crack.py on mmdetection/mmdet/datasets. And add concrete_crack_classes on init.py & class_names.py on mmdetection/mmdet/core/evaluation/class_names.py
Environment
python mmdet/utils/collect_env.py
to collect necessary environment information and paste it here.$PATH
,$LD_LIBRARY_PATH
,$PYTHONPATH
, etc.)Error traceback If applicable, paste the error trackback here.
Traceback (most recent call last): File "./tools/train.py", line 16, in
from mmdet.apis import set_random_seed, train_detector
File "/home/user/mmdetection/mmdet/apis/init.py", line 2, in
from .inference import (async_inference_detector, inference_detector,
File "/home/user/mmdetection/mmdet/apis/inference.py", line 11, in
from mmdet.core import get_classes
File "/home/user/mmdetection/mmdet/core/init.py", line 5, in
from .evaluation import # noqa: F401, F403
File "/home/user/mmdetection/mmdet/core/evaluation/init.py", line 2, in
from .class_names import (concrete_crack_classes, cityscapes_classes, coco_classes, dataset_aliases,
File "/home/user/mmdetection/mmdet/core/evaluation/class_names.py", line 106
'concrete_crack': ['concrete_crack']
^
SyntaxError: invalid syntax
Traceback (most recent call last):
File "./tools/train.py", line 16, in
from mmdet.apis import set_random_seed, train_detector
File "/home/user/mmdetection/mmdet/apis/init.py", line 2, in
from .inference import (async_inference_detector, inference_detector,
File "/home/user/mmdetection/mmdet/apis/inference.py", line 11, in
from mmdet.core import get_classes
File "/home/user/mmdetection/mmdet/core/init.py", line 5, in
from .evaluation import # noqa: F401, F403
File "/home/user/mmdetection/mmdet/core/evaluation/init.py", line 2, in
from .class_names import (concrete_crack_classes, cityscapes_classes, coco_classes, dataset_aliases,
File "/home/user/mmdetection/mmdet/core/evaluation/class_names.py", line 106
'concrete_crack': ['concrete_crack']
^
SyntaxError: invalid syntax
Traceback (most recent call last):
File "./tools/train.py", line 16, in
from mmdet.apis import set_random_seed, train_detector
File "/home/user/mmdetection/mmdet/apis/init.py", line 2, in
from .inference import (async_inference_detector, inference_detector,
File "/home/user/mmdetection/mmdet/apis/inference.py", line 11, in
from mmdet.core import get_classes
File "/home/user/mmdetection/mmdet/core/init.py", line 5, in
from .evaluation import # noqa: F401, F403
File "/home/user/mmdetection/mmdet/core/evaluation/init.py", line 2, in
from .class_names import (concrete_crack_classes, cityscapes_classes, coco_classes, dataset_aliases,
File "/home/user/mmdetection/mmdet/core/evaluation/class_names.py", line 106
'concrete_crack': ['concrete_crack']
^
SyntaxError: invalid syntax
Traceback (most recent call last):
File "./tools/train.py", line 16, in
from mmdet.apis import set_random_seed, train_detector
File "/home/user/mmdetection/mmdet/apis/init.py", line 2, in
from .inference import (async_inference_detector, inference_detector,
File "/home/user/mmdetection/mmdet/apis/inference.py", line 11, in
from mmdet.core import get_classes
File "/home/user/mmdetection/mmdet/core/init.py", line 5, in
from .evaluation import # noqa: F401, F403
File "/home/user/mmdetection/mmdet/core/evaluation/init.py", line 2, in
from .class_names import (concrete_crack_classes, cityscapes_classes, coco_classes, dataset_aliases,
File "/home/user/mmdetection/mmdet/core/evaluation/class_names.py", line 106
'concrete_crack': ['concrete_crack']
^
SyntaxError: invalid syntax
Killing subprocess 23071
Killing subprocess 23072
Killing subprocess 23073
Killing subprocess 23074
Traceback (most recent call last):
File "/usr/lib/python3.7/runpy.py", line 193, in _run_module_as_main
"main", mod_spec)
File "/usr/lib/python3.7/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/home/user/python-envs/mmdet/lib/python3.7/site-packages/torch/distributed/launch.py", line 340, in
main()
File "/home/user/python-envs/mmdet/lib/python3.7/site-packages/torch/distributed/launch.py", line 326, in main
sigkill_handler(signal.SIGTERM, None) # not coming back
File "/home/user/python-envs/mmdet/lib/python3.7/site-packages/torch/distributed/launch.py", line 301, in sigkill_handler
raise subprocess.CalledProcessError(returncode=last_return_code, cmd=cmd)
subprocess.CalledProcessError: Command '['/home/user/python-envs/mmdet/bin/python', '-u', './tools/train.py', '--local_rank=3', 'configs/shm_training/cascade_rcnn_x101_64x4d_fpn_1x_for_concrete_crack_220325.py', '--launcher', 'pytorch']' returned non-zero exit status 1.
Bug fix If you have already identified the reason, you can provide the information here. If you are willing to create a PR to fix it, please also leave a comment here and that would be much appreciated!