Git Product home page Git Product logo

seamseg's Introduction

Seamless Scene Segmentation


CVPR | arXiv

Seamless Scene Segmentation is a CNN-based architecture that can be trained end-to-end to predict a complete class- and instance-specific labeling for each pixel in an image. To tackle this task, also known as "Panoptic Segmentation", we take advantage of a novel segmentation head that seamlessly integrates multi-scale features generated by a Feature Pyramid Network with contextual information conveyed by a light-weight DeepLab-like module.

This repository currently contains training and evaluation code for Seamless Scene Segmentation in PyTorch, based on our re-implementation of Mask R-CNN.

If you use Seamless Scene Segmentation in your research, please cite:

@InProceedings{Porzi_2019_CVPR,
  author = {Porzi, Lorenzo and Rota Bul\`o, Samuel and Colovic, Aleksander and Kontschieder, Peter},
  title = {Seamless Scene Segmentation},
  booktitle = {The IEEE Conference on Computer Vision and Pattern Recognition (CVPR)},
  month = {June},
  year = {2019}
}

Requirements and setup

Main system requirements:

  • CUDA 10.1
  • Linux with GCC 7 or 8
  • PyTorch v1.1.0

IMPORTANT NOTE: These requirements are not necessarily stringent, e.g. it might be possible to compile with older versions of CUDA, or under Windows. However, we have only tested the code under the above settings and cannot provide support for other setups.

IMPORTANT NOTE 2: Due to some breaking changes in the handling of boolean operations, seamseg is currently not compatible with Pytorch v1.2.0 or newer.

To install PyTorch, please refer to https://github.com/pytorch/pytorch#installation.

To install all other dependencies using pip:

pip install -r requirements.txt

Setup

Our code is split into two main components: a library containing implementations for the various network modules, algorithms and utilities, and a set of scripts to train / test the networks.

The library, called seamseg, can be installed with:

git clone https://github.com/mapillary/seamseg.git
cd seamseg
python setup.py install

or, in a single line:

pip install git+https://github.com/mapillary/seamseg.git

The scripts do not require installation (but they do require seamseg to be installed), and can be run from the scripts/ folder. Note: Do not run the scripts from the main folder of this repo, otherwise python might decide to load the local copy of the seamseg package instead of the one installed above, causing issues.

Trained models

The model files provided below are made available under the CC BY-NC-SA 4.0 license.

Model PQ Link + md5
SeamSeg ResNet50, Mapillary Vistas 37.99 7046e54e54e9dcc38060b150e97f4a5a

The files linked above are zip archives, each containing model weights (.tar file), configuration parameters (config.ini file) and the metadata file of the dataset the model was trained on (metadata.bin file). To use a model, unzip it somewhere and follow the instructions in the Running inference" section below.

Using the scripts

Our code uses an intermediate data format to ease training on multiple datasets, described here. We provide pre-made scripts to convert from Cityscapes and Mapillary Vistas to our format.

When training, unless explicitly training from scratch, it's also necessary to convert the ImageNet pre-trained weights provided by PyTorch to our network format. To do this, simply run:

cd scripts/utility
python convert_pytorch_resnet.py NET_NAME OUTPUT_FILE

where NET_NAME is one of resnet18, resnet34, resnet50, resnet101 or resnet152.

Training

Training involves three main steps: Preparing the dataset, creating a configuration file and running the training script. To prepare the dataset, refer to the format description here, or use one of the scripts in scripts/data_preparation. The configuration file is a simple text file in ini format. The default value of each configuration parameter, as well as a short description of what it does, is available in seamseg/config/defaults. Note that these are just an indication of what a "reasonable" value for each parameter could be, and are not meant as a way to reproduce any of the results from our paper.

To launch the training:

cd scripts
python -m torch.distributed.launch --nproc_per_node=N_GPUS train_panoptic.py --log_dir LOG_DIR CONFIG DATA_DIR 

Note that, for now, our code must be launched in "distributed" mode using PyTorch's torch.distributed.launch utility. It's also highly recommended to train on multiple GPUs (possibly 4-8) in order to obtain good results. Training logs, both in text and Tensorboard formats, will be written in LOG_DIR.

The validation metrics reported in the logs include mAP, PQ and mIOU, computed as follows:

  • For mAP (both mask and bounding box), we resort to the original implementation from the COCO API. This is the reason why our dataset format also includes COCO-format annotations.
  • For PQ (Panoptic Quality) and mIOU we use our own implementations. Our PQ metric has been verified to produce results that are equivalent to the official implementation, minus numerical differences.

Training with the Vistas settings from our paper:

cd scripts
python -m torch.distributed.launch --nproc_per_node=8 \
    train_panoptic.py --log_dir LOG_DIR \
    configurations/vistas_r50.ini DATA_DIR

Training with the Cityscapes settings from our paper:

cd scripts
python -m torch.distributed.launch --nproc_per_node=8 \
    train_panoptic.py --log_dir LOG_DIR \
    configurations/cityscapes_r50.ini DATA_DIR

Running inference

Given a trained network, inference can be run on any set of images using scripts/test_panoptic.py:

cd scripts
python -m torch.distributed.launch --nproc_per_node=N_GPUS test_panoptic.py --meta METADATA --log_dir LOG_DIR CONFIG MODEL INPUT_DIR OUTPUT_DIR

Images (either png or jpg) will be read from INPUT_DIR and recursively in all subfolders, and predictions will be written to OUTPUT_DIR. The script also requires to be given the metadata.bin file of the dataset the network was originally trained on. Note that the script will only read from the "meta" section, meaning that a stripped-down version of metadata.bin, i.e. without the "images" section, can also be used.

By default, the test scripts output "qualitative" results, i.e. the original images superimposed with their panoptic segmentation. This can be changed by setting the --raw flag: in this case, the script will output, for each image, the "raw" network output as a PyTorch .pth.tar file. An additional script to process these raw outputs into COCO-format panoptic predictions will be released soon.

seamseg's People

Contributors

ducksoup avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

seamseg's Issues

Expected object of scalar type Byte but got scalar type Bool for argument #2

Hello~seamseg is an awesome work!
When I run panoptic_test.py,I encountered the following error.Do you know why?Thank you for your answer.
Command :python -m torch.distributed.launch --nproc_per_node=1 scripts/test_panoptic.py --meta metadata.bin --log_dir test_log config.ini seamseg_r50_vistas.tar test_input test_output

22:09:13 Creating dataloaders for dataset in test_input
22:09:13 Creating backbone model resnet50
22:09:14 Loading snapshot from seamseg_r50_vistas.tar
Traceback (most recent call last):
  File "scripts/test_panoptic.py", line 352, in <module>
    main(parser.parse_args())
  File "scripts/test_panoptic.py", line 348, in main
    make_panoptic=panoptic_preprocessing, num_stuff=meta["num_stuff"])
  File "scripts/test_panoptic.py", line 218, in test
    panoptic_pred = make_panoptic(sem_pred, bbx_pred, cls_pred, obj_pred, msk_pred, num_stuff)
  File "/home/lin/Software/anaconda3/envs/seamseg/lib/python3.6/site-packages/seamseg-0.1.dev27+gb179f47.d20190926-py3.6-linux-x86_64.egg/seamseg/utils/panoptic.py", line 50, in __call__
    intersection = occupied & msk_i
RuntimeError: Expected object of scalar type Byte but got scalar type Bool for argument #2 'other'
Traceback (most recent call last):
  File "/home/lin/Software/anaconda3/envs/seamseg/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/home/lin/Software/anaconda3/envs/seamseg/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/lin/Software/anaconda3/envs/seamseg/lib/python3.6/site-packages/torch/distributed/launch.py", line 246, in <module>
    main()
  File "/home/lin/Software/anaconda3/envs/seamseg/lib/python3.6/site-packages/torch/distributed/launch.py", line 242, in main
    cmd=cmd)
subprocess.CalledProcessError: Command '['/home/lin/Software/anaconda3/envs/seamseg/bin/python', '-u', 'scripts/test_panoptic.py', '--local_rank=0', '--meta', 'metadata.bin', '--log_dir', 'test_log', 'config.ini', 'seamseg_r50_vistas.tar', 'test_input', 'test_output']' returned non-zero exit status 1.

subprocess.CalledProcessError: Command

root:/data/research/seamseg-master/scripts# python -m torch.distributed.launch --nproc_per_node=2 train_panoptic.py --log_dir ./log.log "/data/research/seamseg-master/seamseg/config/defaults/panoptic.ini" /common-data/jlong.yuan/segmentation/seamseg/Mapillary/
Traceback (most recent call last):
File "train_panoptic.py", line 21, in
from seamseg.config import load_config, DEFAULTS as DEFAULT_CONFIGS
File "/data/config/anaconda3/lib/python3.6/site-packages/seamseg-3.3.3-py3.6-linux-x86_64.egg/seamseg/config/init.py", line 1, in
from .config import load_config, DEFAULTS
File "/data/config/anaconda3/lib/python3.6/site-packages/seamseg-3.3.3-py3.6-linux-x86_64.egg/seamseg/config/config.py", line 11, in
for file in listdir(_DEFAULTS_DIR):
FileNotFoundError: [Errno 2] No such file or directory: '/data/config/anaconda3/lib/python3.6/site-packages/seamseg-3.3.3-py3.6-linux-x86_64.egg/seamseg/config/defaults'
Traceback (most recent call last):
File "train_panoptic.py", line 21, in
from seamseg.config import load_config, DEFAULTS as DEFAULT_CONFIGS
File "/data/config/anaconda3/lib/python3.6/site-packages/seamseg-3.3.3-py3.6-linux-x86_64.egg/seamseg/config/init.py", line 1, in
from .config import load_config, DEFAULTS
File "/data/config/anaconda3/lib/python3.6/site-packages/seamseg-3.3.3-py3.6-linux-x86_64.egg/seamseg/config/config.py", line 11, in
for file in listdir(_DEFAULTS_DIR):
FileNotFoundError: [Errno 2] No such file or directory: '/data/config/anaconda3/lib/python3.6/site-packages/seamseg-3.3.3-py3.6-linux-x86_64.egg/seamseg/config/defaults'
Traceback (most recent call last):
File "/data/config/anaconda3/lib/python3.6/runpy.py", line 193, in _run_module_as_main
"main", mod_spec)
File "/data/config/anaconda3/lib/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/data/config/anaconda3/lib/python3.6/site-packages/torch/distributed/launch.py", line 235, in
main()
File "/data/config/anaconda3/lib/python3.6/site-packages/torch/distributed/launch.py", line 231, in main
cmd=process.args)
subprocess.CalledProcessError: Command '['/data/config/anaconda3/bin/python', '-u', 'train_panoptic.py', '--local_rank=0', '--log_dir', './log.log', '/data/research/seamseg-master/seamseg/config/defaults/panoptic.ini', '/common-data/segmentation/seamseg/Mapillary/']' returned non-zero exit status 1.

Creating a Colab

I was wondering if it's possible to create a colab for this model.

CUDA out of memory

I use 8 gpus. Each one has 16GiB capacity, but the program still meets this problem.
RuntimeError: CUDA out of memory. Tried to allocate 2.00 GiB (GPU 5; 10.92 GiB total capacity; 6.01 GiB already allocated; 1.74 GiB free; 2.62 GiB cached).
How can I fix this problem

Can we run inference on a non CUDA machine?

I am trying to run inference using the pre-trained models on a MacOS machine and getting an AssertionError thrown:

    assert self.local_world_size > 0
           ^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError

This is the command I am trying to run:
python3 -m torch.distributed.launch --nproc_per_node=0 test_panoptic.py --meta ../models/SeamSeg-R50-Vistas/metadata.bin --log_dir ../logs/ ../models/SeamSeg-R50-Vistas/config.ini ../models/SeamSeg-R50-Vistas/seamseg_r50_vistas.tar ../input/ ../output/

Any help will be much appreciated!

training with resolution 1024

I don't have access to enough computation resource so I'm training on 8gpus with resolution 1024 on cityscapes, and I find it really hard to recover the result that's even nearly compatible to the ones in the paper. Would really appreciate if you can let me know if this is caused by the resolution? And what should I modify in configuration for resolution 1024 to work reasonably well?

Training panoptic

I have started training with 4GPUs with batch size of 1 and pretrained resnet101. However it gets stuck at starting epoch 1. No error msg or anything. Following is my panoptic config file that I use.


# GENERAL NOTE: the fields denoted as meta-info are not actual configuration parameters. Instead, they are used to
# describe some characteristic of a network module that needs to be accessible from some other module but is hard to
# determine in a generic way from within the code. A typical example is the total output stride of the network body.
# These should be properly configured by the user to match the actual properties of the network.

[general]
# Number of epochs between validations
val_interval = 1
# Number of steps before outputting a log entry
log_interval = 10
# Panoptic evaluation parameters
score_threshold = 0.5
overlap_threshold = 0.5
min_stuff_area = 4096
# Evaluation mode for mIoU and AP:
# -- panoptic: evaluate the scores on the panoptic output
# -- separate: evaluate the scores on the separate segmentation and detection outputs
eval_mode = panoptic
# Whether to compute COCO evaluation scores or not
eval_coco = no
cudnn_benchmark = no

[body]
# Architecture for the body
body = resnet101
# Path to pre-trained weights
weights = models/resnet101
# Normalization mode:
# -- bn: in-place batch norm everywhere
# -- syncbn: synchronized in-place batch norm everywhere
# -- syncbn+bn: synchronized in-place batch norm in the static part of the network, in-place batch norm everywhere else
# -- gn: group norm everywhere
# -- syncbn+gn: synchronized in-place batch norm in the static part of the network, group norm everywhere else
# -- off: do not normalize activations (scale and bias are kept)
normalization_mode = syncbn
# Activation: 'leaky_relu' or 'elu'
activation = leaky_relu
activation_slope = 0.01
# Group norm parameters
gn_groups = 16
# Additional parameters for the body
body_params = {}
# Number of frozen modules: in [1, 5]
num_frozen = 2
# Wether to freeze BN modules
bn_frozen = yes
# Meta-info
out_channels = {"mod1": 64, "mod2": 256, "mod3": 512, "mod4": 1024, "mod5": 2048}
out_strides = {"mod1": 4, "mod2": 4, "mod3": 8, "mod4": 16, "mod5": 32}

[fpn]
out_channels = 256
extra_scales = 0
interpolation = nearest
# Input settings
inputs = ["mod2", "mod3", "mod4", "mod5"]
# Meta-info
out_strides = (4, 8, 16, 32)

[rpn]
hidden_channels = 256
stride = 1
# Anchor settings
anchor_ratios = (1., 0.5, 2.)
anchor_scale = 8
# Proposal settings
nms_threshold = 0.7
num_pre_nms_train = 12000
num_post_nms_train = 2000
num_pre_nms_val = 6000
num_post_nms_val = 300
min_size = 16
# Anchor matcher settings
num_samples = 256
pos_ratio = .5
pos_threshold = .7
neg_threshold = .3
void_threshold = 0.7
# FPN-specific settings
fpn_min_level = 0
fpn_levels = 4
# Loss settings
sigma = 3.

[roi]
roi_size = (14, 14)
# Matcher settings
num_samples = 128
pos_ratio = .25
pos_threshold = .5
neg_threshold_hi = .5
neg_threshold_lo = 0.
void_threshold = 0.7
void_is_background = no
# Prediction generator settings
nms_threshold = 0.3
score_threshold = 0.05
max_predictions = 100
# FPN-specific settings
fpn_min_level = 0
fpn_levels = 4
fpn_canonical_scale = 224
fpn_canonical_level = 2
# Loss settings
sigma = 1.
bbx_reg_weights = (10., 10., 5., 5.)

[sem]
fpn_min_level = 0
fpn_levels = 4
pooling_size = (64, 64)
# Loss settings
ohem = .25

[optimizer]
lr = 0.01
weight_decay = 0.0001
weight_decay_norm = yes
momentum = 0.9
nesterov = yes
# obj, bbx, roi_cls, roi_bbx, roi_msk, sem
loss_weights = (1., 1., 1., 1., 1., 1.)

[scheduler]
epochs = 90
# Scheduler type: 'linear', 'step', 'poly' or 'multistep'
type = poly
# When to update the learning rate: 'batch', 'epoch'
update_mode = batch
# Additional parameters for the scheduler
# -- linear
#   from: initial lr multiplier
#   to: final lr multiplier
# -- step
#   step_size: number of steps between lr decreases
#   gamma: multiplicative factor
# -- poly
#   gamma: exponent of the polynomial
# -- multistep
#   milestones: step indicies where the lr decreases will be triggered
params = {"gamma": 0.9}
burn_in_steps = 500
burn_in_start = 0.333

[dataloader]
# Image size parameters
shortest_size = 1024
longest_max_size = 2048
# Batch size
train_batch_size =1
val_batch_size =1
# Augmentation parameters
rgb_mean = (0.485, 0.456, 0.406)
rgb_std = (0.229, 0.224, 0.225)
random_flip = yes
random_scale = (0.8, 1)
# Number of worker threads
num_workers = 8
# Subsets
train_set = train
val_set = val
coco_gt =

TypeError: 'NoneType' object is not subscriptable

I am getting this error at the below line.

bbx_out.append(bbx_i[valid])

I tried to print bbx_i and its empty. I did realize that the dataset which I am using does not have bounding box details in it. I used prepare_vistas.py to get the required dataset. After analyzing the whole script I understand that the script doesn't store bounding box details in it. How should I handle in this case? or Did I actually miss out something here?

If anyone could clarify this would be great!! Thanks in advance.

@ducksoup

Add `install_requires` to `setup.py`

Issue summary

In the README's setup section, it says:

or, in a single line:

pip install git+https://github.com/mapillary/seamseg.git

But, since setuptools.setup() does not include the install_requires argument, the projects dependencies do not get installed.

seamseg/setup.py

Lines 34 to 80 in 3d10aea

setuptools.setup(
# Meta-data
name="seamseg",
author="Lorenzo Porzi",
author_email="[email protected]",
description="Seamless Scene Segmentation for Pytorch",
long_description=long_description,
long_description_content_type="text/markdown",
url="https://github.com/mapillary/seamseg",
classifiers=[
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.4",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
],
# Versioning
use_scm_version={"root": ".", "relative_to": __file__, "write_to": "seamseg/_version.py"},
# Requirements
setup_requires=["setuptools_scm"],
python_requires=">=3, <4",
# Package description
packages=[
"seamseg",
"seamseg.algos",
"seamseg.config",
"seamseg.data",
"seamseg.models",
"seamseg.modules",
"seamseg.modules.heads",
"seamseg.utils",
"seamseg.utils.bbx",
"seamseg.utils.nms",
"seamseg.utils.parallel",
"seamseg.utils.roi_sampling",
],
ext_modules=[
make_extension("nms", "seamseg.utils"),
make_extension("bbx", "seamseg.utils"),
make_extension("roi_sampling", "seamseg.utils")
],
cmdclass={"build_ext": BuildExtension},
include_package_data=True,
)

The pip install one-liner ends in errors for me unless I install torch myself. And even when I do that, when I try to run the seamseg scripts, I hit errors because dependencies like umsgpack and inplace_abn are not installed.

Possible solution

Could we add something like this?

...
requirements = []
with open("requirements.txt") as f:
    requirements = f.read().splitlines()

setuptools.setup(
    ...
    # Requirements
    setup_requires=["setuptools_scm"],
    python_requires=">=3, <4",
    install_requires=requirements,
    ...
)

pytorch 1.3 compatibility

Since codes has to upgrade to newest pytorch eventually. Does there any way to make it compatible of both pytorch 1.1 and pytorch 1.3 in terms of these bool value API breaking changes?

RuntimeError: CUDA out of memory. Tried to allocate 464.00 MiB (GPU 1; 10.92 GiB total capacity; 8.43 GiB already allocated; 323.50 MiB free; 1.56 GiB cached)

Traceback (most recent call last):
File "train_panoptic.py", line 628, in
main(parser.parse_args())
File "train_panoptic.py", line 589, in main
global_step=global_step, loss_weights=config["optimizer"].getstruct("loss_weights"))
File "train_panoptic.py", line 296, in train
losses, _, conf = model(**batch, do_loss=True, do_prediction=False)
File "/opt/conda/lib/python3.6/site-packages/torch/nn/modules/module.py", line 493, in call
result = self.forward(*input, **kwargs)
File "/opt/conda/lib/python3.6/site-packages/torch/nn/parallel/distributed.py", line 376, in forward
output = self.module(*inputs[0], **kwargs[0])
File "/opt/conda/lib/python3.6/site-packages/torch/nn/modules/module.py", line 493, in call
result = self.forward(*input, **kwargs)
File "/opt/conda/lib/python3.6/site-packages/seamseg-0.1.dev31+g18e28cc-py3.6-linux-x86_64.egg/seamseg/models/panoptic.py", line 76, in forward
self.rpn_head, x, bbx, iscrowd, valid_size, training=self.training, do_inference=True)
File "/opt/conda/lib/python3.6/site-packages/seamseg-0.1.dev31+g18e28cc-py3.6-linux-x86_64.egg/seamseg/algos/fpn.py", line 84, in training
obj_logits, bbx_logits, h, w = self._get_logits(head, x)
File "/opt/conda/lib/python3.6/site-packages/seamseg-0.1.dev31+g18e28cc-py3.6-linux-x86_64.egg/seamseg/algos/fpn.py", line 57, in _get_logits
obj_logits_i, bbx_logits_i = head(x_i)
File "/opt/conda/lib/python3.6/site-packages/torch/nn/modules/module.py", line 493, in call
result = self.forward(*input, **kwargs)
File "/opt/conda/lib/python3.6/site-packages/seamseg-0.1.dev31+g18e28cc-py3.6-linux-x86_64.egg/seamseg/modules/heads/rpn.py", line 62, in forward
x = self.conv1(x)
File "/opt/conda/lib/python3.6/site-packages/torch/nn/modules/module.py", line 493, in call
result = self.forward(*input, **kwargs)
File "/opt/conda/lib/python3.6/site-packages/torch/nn/modules/conv.py", line 338, in forward
self.padding, self.dilation, self.groups)
RuntimeError: CUDA out of memory. Tried to allocate 464.00 MiB (GPU 1; 10.92 GiB total capacity; 8.43 GiB already allocated; 323.50 MiB free; 1.56 GiB cached)
^CTraceback (most recent call last):
File "/opt/conda/lib/python3.6/runpy.py", line 193, in _run_module_as_main
"main", mod_spec)
File "/opt/conda/lib/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/opt/conda/lib/python3.6/site-packages/torch/distributed/launch.py", line 235, in
main()
File "/opt/conda/lib/python3.6/site-packages/torch/distributed/launch.py", line 228, in main
process.wait()
File "/opt/conda/lib/python3.6/subprocess.py", line 1477, in wait
(pid, sts) = self._try_wait(0)
File "/opt/conda/lib/python3.6/subprocess.py", line 1424, in _try_wait
(pid, sts) = os.waitpid(self.pid, wait_flags)

when I run "python -m torch.distributed.launch --nproc_per_node=2 train_panoptic.py --log_dir LOG_DIR configurations/cityscapes_r50.ini ../dataset_root/" on two 2080ti GPU of 12G memory and set the batch_size as 1 for both training and validation, it always show CUDA out of memory. If the code only run on the GPU of 16G memory.

Get panoptic outputs

Hi, thanks for this great repo!
The script test_panoptic.py only generates the semantic prediction map for each input image instead of panoptic one. How can I obtain the prediction maps in panoptic format, like those ground truth *_gtFine_instanceIds.png of Cityscapes?
Thanks!

Mseg Dataset !

Hi @ducksoup ,

I m just wondering if you have retrained Seamseg on a composite datasets as M-Seg dataset in a form of panoptic segmentation.

https://github.com/mseg-dataset/mseg-semantic

Best.
Tarek

ImportError: ~/anaconda3/lib/python3.7/site-packages/inplace_abn/_backend.cpython-37m-x86_64-linux-gnu.so: undefined symbol: _ZN6caffe26detail36_typeMetaDataInstance_preallocated_7E

Using CUDA 11.3 , PyTorch v1.7, Ubuntu 18.04.5 LTS. While executing:

python -m torch.distributed.launch --nproc_per_node=1 test_panoptic.py --meta metadata.bin --log_dir ~/logs config.ini seamseg_r50_vistas.tar images predictions

Given the following error. If anyone can provide help it will be much appreciated:

Traceback (most recent call last):
File "test_panoptic.py", line 16, in
import seamseg.models as models
File "anaconda3/lib/python3.7/site-packages/seamseg-0.1.dev37+g3d10aea-py3.7-linux-x86_64.egg/seamseg/models/init.py", line 1, in
from .resnet import *
File "anaconda3/lib/python3.7/site-packages/seamseg-0.1.dev37+g3d10aea-py3.7-linux-x86_64.egg/seamseg/models/resnet.py", line 6, in
from inplace_abn import ABN
File "anaconda3/lib/python3.7/site-packages/inplace_abn/init.py", line 1, in
from .abn import ABN, InPlaceABN, InPlaceABNSync
File "anaconda3/lib/python3.7/site-packages/inplace_abn/abn.py", line 7, in
from .functions import inplace_abn, inplace_abn_sync
File "anaconda3/lib/python3.7/site-packages/inplace_abn/functions.py", line 9, in
from . import _backend
ImportError: anaconda3/lib/python3.7/site-packages/inplace_abn/_backend.cpython-37m-x86_64-linux-gnu.so: undefined symbol: _ZN6caffe26detail36_typeMetaDataInstance_preallocated_7E
Traceback (most recent call last):
File "anaconda3/lib/python3.7/runpy.py", line 193, in _run_module_as_main
"main", mod_spec)
File "anaconda3/lib/python3.7/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "anaconda3/lib/python3.7/site-packages/torch/distributed/launch.py", line 260, in
main()
File "anaconda3/lib/python3.7/site-packages/torch/distributed/launch.py", line 256, in main
cmd=cmd)
subprocess.CalledProcessError: Command '['anaconda3/bin/python', '-u', 'test_panoptic.py', '--local_rank=0', '--meta', 'metadata.bin', '--log_dir', 'logs', 'seamseg_vistas/config.ini', 'seamseg_vistas/seamseg_r50_vistas.tar', 'images', 'predictions']' returned non-zero exit status 1.

ImportError: libtorch.so: cannot open shared object file: No such file or directory

Hi,

I am trying to load the pertained mode provided by you to carry out some evaluation on a set of images. I followed the instruction you provided to install the dependencies and packages. However, I am getting the error below which implies that a package is missing. I appreciate if you could advise me on this issue.

"""""""""""""""""""""""""""""""""""""""""""""""
Traceback (most recent call last):
File "test_panoptic.py", line 17, in
from seamseg.algos.detection import PredictionGenerator as BbxPredictionGenerator, DetectionLoss,
File "PATH-TO-ANACONDA/envs/seamseg/lib/python3.6/site-packages/seamseg-0.1.dev37+g3d10aea-py3.6-linux-x86_64.egg/seamseg/algos/detection.py", line 6, in
from seamseg.utils.bbx import ious, calculate_shift, bbx_overlap, mask_overlap
File "PATH-TO-ANACONDA/envs/seamseg/lib/python3.6/site-packages/seamseg-0.1.dev37+g3d10aea-py3.6-linux-x86_64.egg/seamseg/utils/bbx/init.py", line 1, in
from .bbx import *
File "PATH-TO-ANACONDA/envs/seamseg/lib/python3.6/site-packages/seamseg-0.1.dev37+g3d10aea-py3.6-linux-x86_64.egg/seamseg/utils/bbx/bbx.py", line 5, in
from . import _backend
ImportError: libtorch.so: cannot open shared object file: No such file or directory
Traceback (most recent call last):
File "PATH-TO-ANACONDA/envs/seamseg/lib/python3.6/runpy.py", line 193, in _run_module_as_main
"main", mod_spec)
File "PATH-TO-ANACONDA/envs/seamseg/lib/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "PATH-TO-ANACONDA/envs/seamseg/lib/python3.6/site-packages/torch/distributed/launch.py", line 235, in
main()
File "PATH-TO-ANACONDA/envs/seamseg/lib/python3.6/site-packages/torch/distributed/launch.py", line 231, in main
cmd=process.args)
subprocess.CalledProcessError: Command '['PATH-TO-ANACONDA/envs/seamseg/bin/python', '-u', 'test_panoptic.py', '--local_rank=0', '--meta', '../checkpoints/seamseg_r50_vistas/metadata.bin', '--log_dir', '../log', '../checkpoints/seamseg_r50_vistas/config.ini', '../checkpoints/seamseg_r50_vistas/seamseg_r50_vistas.tar', '../../signals/data/frames/23', '../out']' returned non-zero exit status 1.

"""""""""""""""""""""""""""""""""""""""""""""""

My system config is :
CUDA10.1
GCC7
Python 3.6
torch1.1

I ran this command to do inference:

python -m torch.distributed.launch --nproc_per_node=1 test_panoptic.py --meta "../checkpoints/seamseg_r50_vistas/metadata.bin" --log_dir '../log' '../checkpoints/seamseg_r50_vistas/config.ini' '../checkpoints/seamseg_r50_vistas/seamseg_r50_vistas.tar' '../frames' '../out'

Any default config file for only semantic segmentation?

Dear Author,

Thanks very much for your work, we can train and test on your code successfully. I just have a question that whether there is a default config file for only semantic segmentation? Because I have saw there are instance segmentation and object detection config file besides the Panoptic Segmentation config file.

Thanks.

ValueError: invalid literal for int() with base 10: ''

Traceback (most recent call last):
File "test_panoptic.py", line 358, in
main(parser.parse_args())
File "test_panoptic.py", line 322, in main
Traceback (most recent call last):
File "test_panoptic.py", line 358, in
test_dataloader = make_dataloader(args, config, rank, world_size)
File "test_panoptic.py", line 80, in make_dataloader
test_sampler = DistributedARBatchSampler(test_db, config.getint("val_batch_size"), world_size, rank, False)
File "/usr/lib/python3.6/configparser.py", line 1283, in get
main(parser.parse_args())
File "test_panoptic.py", line 322, in main
test_dataloader = make_dataloader(args, config, rank, world_size)
File "test_panoptic.py", line 80, in make_dataloader
test_sampler = DistributedARBatchSampler(test_db, config.getint("val_batch_size"), world_size, rank, False)
File "/usr/lib/python3.6/configparser.py", line 1283, in get
fallback=fallback, **kwargs)
File "/usr/lib/python3.6/configparser.py", line 819, in getint
fallback=fallback, **kwargs)
File "/usr/lib/python3.6/configparser.py", line 819, in getint
fallback=fallback, **kwargs)
File "/usr/lib/python3.6/configparser.py", line 809, in _get_conv
fallback=fallback, **kwargs)
File "/usr/lib/python3.6/configparser.py", line 809, in _get_conv
**kwargs)
File "/usr/lib/python3.6/configparser.py", line 803, in _get
**kwargs)
File "/usr/lib/python3.6/configparser.py", line 803, in _get
return conv(self.get(section, option, **kwargs))
ValueError: invalid literal for int() with base 10: ''
return conv(self.get(section, option, **kwargs))
ValueError: invalid literal for int() with base 10: ''
Traceback (most recent call last):
File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
"main", mod_spec)
File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/usr/local/lib/python3.6/dist-packages/torch/distributed/launch.py", line 246, in
main()
File "/usr/local/lib/python3.6/dist-packages/torch/distributed/launch.py", line 242, in main
cmd=cmd)
subprocess.CalledProcessError: Command '['/home/teai/Pramod/pramod_env/bin/python3', '-u', 'test_panoptic.py', '--local_rank=1', 'config=/home/teai/Pramod/Segmentation/seamseg/seamseg_r50_vistas/config.ini', 'model=/home/teai/Pramod/Segmentation/seamseg/seamseg_r50_vistas/seamseg_r50_vistas.tar', 'data=/home/teai/Pramod/Segmentation/seamseg/Input_dir/', 'out_dir=/home/teai/Pramod/Segmentation/seamseg/Output_dir']' returned non-zero exit status 1.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.