openseg-group / openseg.pytorch

The official Pytorch implementation of OCNet, OCRNet, and SegFix.
MIT License
1.19k stars 140 forks source link

confusion regarding custom dataset #75

Closed gigasurgeon closed 3 years ago

gigasurgeon commented 3 years ago

I want to train segfix on my custom dataset. The dataset contains 10 classes and the image size is 2048X2048. While going through the script, I found this "export dt_num_classes=8" in run_h_48_d_4_segfix.sh. Do I need to change this to 10? Also there's this line "assert num_classes in (4, 8, 16, 32,)" in offset_helper.py. What parameters do I need to change and where?

I tried to change some of these parameters to 10 but I recieved the error

Requirement already satisfied: yacs in /home/workspace/projects/env_aseg/lib/python3.6/site-packages (0.1.8) Requirement already satisfied: PyYAML in /home/workspace/projects/env_aseg/lib/python3.6/site-packages (from yacs) (5.4.1) Requirement already satisfied: torchcontrib in /home/workspace/projects/env_aseg/lib/python3.6/site-packages (0.0.2) Requirement already satisfied: pydensecrf in /home/workspace/projects/env_aseg/lib/python3.6/site-packages (1.0rc3) dt_max_distance: 5 dt_num_classes: 8 offset_dir: offset_gt/dt_offset Logging to ./log/cityscapes/segfix_hrnet_hrnet48_segfix_loss_1.log 2021-07-17 17:54:46,324 INFO [offset_helper.py, 55] engery/max-distance: 5 engery/min-distance: 0 2021-07-17 17:54:46,324 INFO [offset_helper.py, 62] direction/num_classes: 8 scale: 1 2021-07-17 17:54:46,324 INFO [offset_helper.py, 67] c4 align axis: False 2021-07-17 17:54:46,334 INFO [module_runner.py, 44] BN Type is inplace_abn. 2021-07-17 17:54:46,334 INFO [init.py, 17] Using evaluator: StandardEvaluator Traceback (most recent call last): File "main.py", line 214, in model = Trainer(configer) File "/home/workspace/projects/segfix_falcon/openseg.pytorch/segmentor/trainer.py", line 70, in init self._init_model() File "/home/workspace/projects/segfix_falcon/openseg.pytorch/segmentor/trainer.py", line 73, in _init_model self.seg_net = self.model_manager.semantic_segmentor() File "/home/workspace/projects/segfix_falcon/openseg.pytorch/lib/models/model_manager.py", line 86, in semantic_segmentor model = SEG_MODEL_DICTmodel_name File "/home/workspace/projects/segfix_falcon/openseg.pytorch/lib/models/nets/segfix.py", line 29, in init self.backbone = BackboneSelector(configer).get_backbone() File "/home/workspace/projects/segfix_falcon/openseg.pytorch/lib/models/backbones/backbone_selector.py", line 34, in get_backbone model = HRNetBackbone(self.configer)(**params) File "/home/workspace/projects/segfix_falcon/openseg.pytorch/lib/models/backbones/hrnet/hrnet_backbone.py", line 769, in call bn_momentum=0.1) File "/home/workspace/projects/segfix_falcon/openseg.pytorch/lib/models/backbones/hrnet/hrnet_backbone.py", line 313, in init self.bn1 = ModuleHelper.BatchNorm2d(bn_type=bn_type)(64, momentum=bn_momentum) TypeError: 'NoneType' object is not callable

PkuRainBow commented 3 years ago

@thegigasurgeon Thanks for your interest in our work!

You should train the SegFix model on your datasets in advance~