Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting panoptic_label_divisor=None gives error #37

Closed
mi2celis opened this issue Jul 22, 2021 · 5 comments
Closed

Setting panoptic_label_divisor=None gives error #37

mi2celis opened this issue Jul 22, 2021 · 5 comments

Comments

@mi2celis
Copy link

I am trying to run training with the cityscapes dataset with only semantic segmentation annotations.
I have set panoptic_label_divisor=None in dataset.py. I'm using ${DEEPLAB2}/configs/cityscapes/panoptic_deeplab/ resnet50_os32_semseg.textproto, where the instance branch is not initiated.

When running:
python trainer/train.py
--config_file= deeplab2/configs/cityscapes/panoptic_deeplab/resnet50_os32_semseg.textproto
--mode=train
--model_dir=deeplab2/model
--num_gpus=1

I get the following error

Traceback (most recent call last):
File "trainer/train.py", line 81, in
app.run(main)
File "/home/mimi/Envs/deeplab2/lib/python3.6/site-packages/absl/app.py", line 312, in run
_run_main(main, args)
File "/home/mimi/Envs/deeplab2/lib/python3.6/site-packages/absl/app.py", line 258, in _run_main
sys.exit(main(argv))
File "trainer/train.py", line 77, in main
FLAGS.num_gpus)
File "/home/mimi/code/deeplab2_proj/deeplab2/trainer/train_lib.py", line 137, in run_experiment
trainer = trainer_lib.Trainer(config, deeplab_model, losses, global_step)
File "/home/mimi/code/deeplab2_proj/deeplab2/trainer/trainer.py", line 137, in init
only_semantic_annotations=not support_panoptic)
File "/home/mimi/code/deeplab2_proj/deeplab2/trainer/runner_utils.py", line 122, in create_dataset
focus_small_instances=focus_small_instances)
File "/home/mimi/code/deeplab2_proj/deeplab2/data/sample_generator.py", line 127, in init
*self._dataset_info['panoptic_label_divisor'],
TypeError: unsupported operand type(s) for : 'int' and 'NoneType'

Any suggestions of what may be the problem.

@aquariusjay
Copy link
Contributor

Hi mi2celis,

Thanks for the question.

To train the model on Cityscaspes semantic segmentation, you do not need to change anything except use the resnet50_os32_semseg.textproto.

The dataset name in the textproto should still be "cityscapes_panoptic" (as shown here) and the dataset is converted in the same way as the tutorial.

The code currently only reads panoptic dataset format, as shown in this line.

Hope that helps.

Cheers,

@mi2celis
Copy link
Author

Got it! Thank you for the prompt reply.

So, if my dataset only contains semantic segmentation annotations, can I still use DeepLab2 to train as explained in the section to convert your own dataset ?

@aquariusjay
Copy link
Contributor

Hi mi2celis,

Yes, that is correct. Basically, you consider your dataset as the one that contains only stuff classes.
I think we have a typo in the doc about setting panoptic_label_divisor=None where you should actually still set a panoptic_label_divisor (e.g., 256 or even smaller) since the code only reads panoptic dataset format at the moment (e.g., here).
We will update the doc soon. Thanks for bringing up the issue.

Additionally, you may first want to make sure if you could successfully train Cityscapes semantic segmentation.

Cheers,

@aquariusjay
Copy link
Contributor

Hi mi2celis,

Let me add a bit more details here which may be helpful when you will be converting your own dataset.

Since the code only reads panoptic data at the moment, you need to set panoptic_label_divisor = k, where k is any integer, instance_id = 0, and class_has_instances_list = [] (i.e., we treat the dataset as the one that contains only stuff classes), when you are (1) converting the dataset to TFRecord, and (2) adding dataset information in dataset.py.

We will update the doc to include this information soon.

Please feel free to report some more issues afterwards.

Cheers,

ClaireXie pushed a commit that referenced this issue Jul 23, 2021
We current only support reading panoptic data format.
To train with only semantic segmentation, we treat them as `stuff` classes and still need to set the panoptic_label_divisor.
The same issue has been discussed at
#37

PiperOrigin-RevId: 386383549
@aquariusjay
Copy link
Contributor

Closing the issue as there is no active discussion for a while.
Please feel free to reopen or create a new one if you still have any questions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants