Unable to run the configurations for SegNet on ADE20K
See original GitHub issueHi,
Thank you for building this useful library. I’ve been trying to run the config file for SegNet on ADE20K as a first try because I would like to run the model on my own dataset. However, I’ve got the following error. I will appreciate your help.
The error:
Traceback (most recent call last): File "train.py", line 61, in <module> main(config, args.resume) File "train.py", line 22, in main train_loader = get_instance(dataloaders, 'train_loader', config) File "train.py", line 16, in get_instance return getattr(module, config[name]['type'])(*args, **config[name]['args']) TypeError: 'module' object is not callable
Here is the modified config file:
` { “name”: “SegNet”, “n_gpu”: 1, “use_synch_bn”: true,
"arch": {
"type": "SegNet",
"args": {
"backbone": "resnet50",
"freeze_bn": false,
"freeze_backbone": false
}
},
"train_loader": {
"type": "ade20k",
"args":{
"data_dir": "ADEChallengeData2016/images/training/",
"batch_size": 8,
"base_size": 400,
"crop_size": 380,
"augment": true,
"shuffle": true,
"scale": true,
"flip": true,
"rotate": true,
"blur": false,
"split": "train_aug",
"num_workers": 8
}
},
"val_loader": {
"type": "ade20k",
"args":{
"data_dir": "ADEChallengeData2016/images/validation/",
"batch_size": 8,
"crop_size": 480,
"val": true,
"split": "val",
"num_workers": 4
}
},
"optimizer": {
"type": "SGD",
"differential_lr": true,
"args":{
"lr": 0.01,
"weight_decay": 1e-4,
"momentum": 0.9
}
},
"loss": "CrossEntropyLoss2d",
"ignore_index": 255,
"lr_scheduler": {
"type": "Poly",
"args": {}
},
"trainer": {
"epochs": 80,
"save_dir": "saved/",
"save_period": 10,
"monitor": "max Mean_IoU",
"early_stop": 10,
"tensorboard": true,
"log_dir": "saved/runs",
"log_per_iter": 20,
"val": true,
"val_per_epochs": 5
}
} `
I’m not sure if I modified the file correctly. Thanks!
Issue Analytics
- State:
- Created 4 years ago
- Comments:21 (9 by maintainers)
Thanks for the code, the problem is that for one of your labels, the class ID is > 5 or < 0 (because you have 6 classes), what you can do is add an assert to find the root of the problem, then you can find the value of the id class that causes the error and add it as an ignore class.
add this after
label = np.asarray(Image.open(label_path), dtype=np.int32)
:assert img.max() < 6 and img.min() >= 0, f"the ID cause problem is one of {img.max()}, {img.min()} of image {image_id}"
Did you solve this issue?