ICNet and PSPNet-50 in Tensorflow for real-time semantic segmentation

Overview

Real-Time Semantic Segmentation in TensorFlow

Perform pixel-wise semantic segmentation on high-resolution images in real-time with Image Cascade Network (ICNet), the highly optimized version of the state-of-the-art Pyramid Scene Parsing Network (PSPNet). This project implements ICNet and PSPNet50 in Tensorflow with training support for Cityscapes.

Download pre-trained ICNet and PSPNet50 models here

Deploy ICNet and preform inference at over 30fps on NVIDIA Titan Xp.

This implementation is based off of the original ICNet paper proposed by Hengshuang Zhao titled ICNet for Real-Time Semantic Segmentation on High-Resolution Images. Some ideas were also taken from their previous PSPNet paper, Pyramid Scene Parsing Network. The network compression implemented is based on the paper Pruning Filters for Efficient ConvNets.

Release information

October 14, 2018

An ICNet model trained in August, 2018 has been released as a pre-trained model in the Model Zoo. All the models were trained without coarse labels and are evaluated on the validation set.

September 22, 2018

The baseline PSPNet50 pre-trained model files have been released publically in the Model Zoo. The accuracy of the model surpases that referenced in the ICNet paper.

August 12, 2018

Initial release. Project includes scripts for training ICNet, evaluating ICNet and compressing ICNet from ResNet50 weights. Also includes scripts for training PSPNet and evaluating PSPNet as a baseline.

Documentation

Model Depot Inference Tutorials

Overview

ICNet model in Tensorboard.

Training ICNet from Classification Weights

This project has implemented the ICNet training process, allowing you to train your own model directly from ResNet50 weights as is done in the original work. Other available implementations simply convert the Caffe model to Tensorflow, only allowing for fine-tuning from weights trained on Cityscapes.

By training ICNet on weights initialized from ImageNet, you have more flexibility in the transfer learning process. Read more about setting up this process can be found here. For training ICNet, follow the guide here.

ICNet Network Compression

In order to achieve real-time speeds, ICNet uses a form of network compression called filter pruning. This drastically reduces the complexity of the model by removing filters from convolutional layers in the network. This project has also implemented this ICNet compression process directly in Tensorflow.

The compression is working, however which "compression scheme" to use is still somewhat ambiguous when reading the original ICNet paper. This is still a work in progress.

PSPNet Baseline Implementation

In order to also reproduce the baselines used in the original ICNet paper, you will also find implementations and pre-trained models for PSPNet50. Since ICNet can be thought of as a modified PSPNet, it can be useful for comparison purposes.

Informtion on training or using the baseline PSPNet50 model can be found here.

Maintainers

If you found the project, documentation and the provided pretrained models useful in your work, consider citing it with

@misc{fastsemseg2018,
  author={Andrienko, Oles},
  title={Fast Semantic Segmentation},
  howpublished={\url{https://github.com/oandrienko/fast-semantic-segmentation}},
  year={2018}
}

Related Work

This project and some of the documentation was based on the Tensorflow Object Detection API. It was the initial inspiration for this project. The third_party directory of this project contains files from OpenAI's Gradient Checkpointing project by Tim Salimans and Yaroslav Bulatov. The helper modules found in third_party/model_deploy.py are from the Tensorflow Slim project. Finally, another open source ICNet implementation which converts the original Caffe network weights to Tensorflow was used as a reference. Find all these projects below:

Thanks

  • This project could not have happened without the advice (and GPU access) given by Professor Steven Waslander and Ali Harakeh from the Waterloo Autonomous Vehicles Lab (now the Toronto Robotics and Artificial Intelligence Lab).
Comments
  • Key CascadeFeatureFusion/Conv/BatchNorm/beta not found in checkpoint

    Key CascadeFeatureFusion/Conv/BatchNorm/beta not found in checkpoint

    Thank you for spending all the time for us!

    I have applied your suggestions, checked out master and renamed the nodes since I trained pspnet already. At stage 1 of the training, when I run the export.py script, I have the following issue: _### _NotFoundError (see above for traceback): Key CascadeFeatureFusion/Conv/BatchNorm/beta not found in checkpoint [[Node: save/RestoreV2 = RestoreV2[dtypes=[DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, ..., DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_INT64], device="/job:localhost/replica:0/task:0/device:CPU:0"](arg_save/Const_0_0, save/RestoreV2/tensor_names, save/RestoreV2/shape_and_slices)]]

    opened by julienip 9
  • TensorFlow 1.10 compatible issue

    TensorFlow 1.10 compatible issue

    Hi, I think the code have some compatible issue on TensorFlow 1.10 or 1.11 or 1.12:

    Traceback (most recent call last):
      File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/client/session.py", line 1334, in _do_call
        return fn(*args)
      File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/client/session.py", line 1319, in _run_fn
        options, feed_dict, fetch_list, target_list, run_metadata)
      File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/client/session.py", line 1407, in _call_tf_sessionrun
        run_metadata)
    tensorflow.python.framework.errors_impl.UnknownError: Failed to get convolution algorithm. This is probably because cuDNN failed to initialize, so try looking to see if a warning log message was printed above.
    	 [[{{node Conv/Conv2D}} = Conv2D[T=DT_FLOAT, data_format="NCHW", dilations=[1, 1, 1, 1], padding="SAME", strides=[1, 1, 2, 2], use_cudnn_on_gpu=true, _device="/job:localhost/replica:0/task:0/device:GPU:0"](Conv/Conv2D-0-TransposeNHWCToNCHW-LayoutOptimizer, Conv/weights/read)]]
    	 [[{{node predictions_1/_635}} = _Recv[client_terminated=false, recv_device="/job:localhost/replica:0/task:0/device:CPU:0", send_device="/job:localhost/replica:0/task:0/device:GPU:0", send_device_incarnation=1, tensor_name="edge_1450_predictions_1", tensor_type=DT_FLOAT, _device="/job:localhost/replica:0/task:0/device:CPU:0"]()]]
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "inference.py", line 142, in <module>
        tf.app.run()
      File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/platform/app.py", line 125, in run
        _sys.exit(main(argv))
      File "inference.py", line 139, in main
        label_map, output_directory)
      File "inference.py", line 95, in run_inference_graph
        feed_dict={placeholder_tensor: image_raw})
      File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/client/session.py", line 929, in run
        run_metadata_ptr)
      File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/client/session.py", line 1152, in _run
        feed_dict_tensor, options, run_metadata)
      File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/client/session.py", line 1328, in _do_run
        run_metadata)
      File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/client/session.py", line 1348, in _do_call
        raise type(e)(node_def, op, message)
    tensorflow.python.framework.errors_impl.UnknownError: Failed to get convolution algorithm. This is probably because cuDNN failed to initialize, so try looking to see if a warning log message was printed above.
    	 [[node Conv/Conv2D (defined at /usr/local/lib/python3.6/dist-packages/tensorflow/contrib/layers/python/layers/layers.py:1057)  = Conv2D[T=DT_FLOAT, data_format="NCHW", dilations=[1, 1, 1, 1], padding="SAME", strides=[1, 1, 2, 2], use_cudnn_on_gpu=true, _device="/job:localhost/replica:0/task:0/device:GPU:0"](Conv/Conv2D-0-TransposeNHWCToNCHW-LayoutOptimizer, Conv/weights/read)]]
    	 [[{{node predictions_1/_635}} = _Recv[client_terminated=false, recv_device="/job:localhost/replica:0/task:0/device:CPU:0", send_device="/job:localhost/replica:0/task:0/device:GPU:0", send_device_incarnation=1, tensor_name="edge_1450_predictions_1", tensor_type=DT_FLOAT, _device="/job:localhost/replica:0/task:0/device:CPU:0"]()]]
    
    Caused by op 'Conv/Conv2D', defined at:
      File "inference.py", line 142, in <module>
        tf.app.run()
      File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/platform/app.py", line 125, in run
        _sys.exit(main(argv))
      File "inference.py", line 139, in main
        label_map, output_directory)
      File "inference.py", line 82, in run_inference_graph
        label_color_map=label_color_map)
      File "/media/jintian/netac/ai/home/fast-semantic-segmentation/libs/exporter.py", line 64, in deploy_segmentation_inference_graph
        outputs = _get_outputs_from_inputs(model, input_tensor)
      File "/media/jintian/netac/ai/home/fast-semantic-segmentation/libs/exporter.py", line 38, in _get_outputs_from_inputs
        outputs_dict = model.predict(preprocessed_inputs)
      File "/media/jintian/netac/ai/home/fast-semantic-segmentation/architectures/icnet_architecture.py", line 117, in predict
        full_res = self._third_feature_branch(preprocessed_inputs)
      File "/media/jintian/netac/ai/home/fast-semantic-segmentation/architectures/icnet_architecture.py", line 203, in _third_feature_branch
        stride=2, normalizer_fn=slim.batch_norm)
      File "/usr/local/lib/python3.6/dist-packages/tensorflow/contrib/framework/python/ops/arg_scope.py", line 182, in func_with_args
        return func(*args, **current_args)
      File "/usr/local/lib/python3.6/dist-packages/tensorflow/contrib/layers/python/layers/layers.py", line 1154, in convolution2d
        conv_dims=2)
      File "/usr/local/lib/python3.6/dist-packages/tensorflow/contrib/framework/python/ops/arg_scope.py", line 182, in func_with_args
        return func(*args, **current_args)
      File "/usr/local/lib/python3.6/dist-packages/tensorflow/contrib/layers/python/layers/layers.py", line 1057, in convolution
        outputs = layer.apply(inputs)
      File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/keras/engine/base_layer.py", line 817, in apply
        return self.__call__(inputs, *args, **kwargs)
      File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/layers/base.py", line 374, in __call__
        outputs = super(Layer, self).__call__(inputs, *args, **kwargs)
      File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/keras/engine/base_layer.py", line 757, in __call__
        outputs = self.call(inputs, *args, **kwargs)
      File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/keras/layers/convolutional.py", line 194, in call
        outputs = self._convolution_op(inputs, self.kernel)
      File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/ops/nn_ops.py", line 868, in __call__
        return self.conv_op(inp, filter)
      File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/ops/nn_ops.py", line 520, in __call__
        return self.call(inp, filter)
      File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/ops/nn_ops.py", line 204, in __call__
        name=self.name)
      File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/ops/gen_nn_ops.py", line 957, in conv2d
        data_format=data_format, dilations=dilations, name=name)
      File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/op_def_library.py", line 787, in _apply_op_helper
        op_def=op_def)
      File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/util/deprecation.py", line 488, in new_func
        return func(*args, **kwargs)
      File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/ops.py", line 3274, in create_op
        op_def=op_def)
      File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/ops.py", line 1770, in __init__
        self._traceback = tf_stack.extract_stack()
    
    UnknownError (see above for traceback): Failed to get convolution algorithm. This is probably because cuDNN failed to initialize, so try looking to see if a warning log message was printed above.
    	 [[node Conv/Conv2D (defined at /usr/local/lib/python3.6/dist-packages/tensorflow/contrib/layers/python/layers/layers.py:1057)  = Conv2D[T=DT_FLOAT, data_format="NCHW", dilations=[1, 1, 1, 1], padding="SAME", strides=[1, 1, 2, 2], use_cudnn_on_gpu=true, _device="/job:localhost/replica:0/task:0/device:GPU:0"](Conv/Conv2D-0-TransposeNHWCToNCHW-LayoutOptimizer, Conv/weights/read)]]
    	 [[{{node predictions_1/_635}} = _Recv[client_terminated=false, recv_device="/job:localhost/replica:0/task:0/device:CPU:0", send_device="/job:localhost/replica:0/task:0/device:GPU:0", send_device_incarnation=1, tensor_name="edge_1450_predictions_1", tensor_type=DT_FLOAT, _device="/job:localhost/replica:0/task:0/device:CPU:0"]()]]
    
    

    It would be better if code can upgrade to tensorflow1.11

    opened by jinfagang 7
  • Training logs and multi-gpu

    Training logs and multi-gpu

    Hi! I am looking at your code, and wanted to train ICNet as you describe it in you nice documentation. I have two questions regarding the PSPNet fine tuning part where you use the train_mem_saving.py

    • I was expecting to have some feedback along the way when its training, but besides 2 times a log that a checkpoint was saved, nothing is printed, is it normal ?
    • I also tried to use it with two gpus. I tried to change the num_clones flag but I get an KeyError that comes from the create_clones() in the trainer.py. Is there anything else I should do to use several GPUs to train ?

    Thanks a lot :)

    opened by mattpfr 7
  • For c++ pb

    For c++ pb

    Is the input node name "inputs" ? output nodename "Predictions/Conv/Conv2D" ?

    And what size and type is the input and output tensor?

    opened by engineer1109 6
  • Help: Convert ICNET_0.5 to onnx file

    Help: Convert ICNET_0.5 to onnx file

    Hello,

    I want to transform this TF model: ICNET_0.5 to onnx and I followed this example: ConvertingSSDMobilenetToONNX

    I understood if I just want to inference I should use the frozen graph (frozen_inference_graph.pb) so I changed the name to savel_model.pb (it seems that tf2onnx does not recognize other name) and run the following with this error:

    C:\Users\esarojp\Desktop\newmodel\0818_icnet_0.5_1025_resnet_v1.tar> python -m tf2onnx.convert --opset 10 --fold_const --saved-model .\0818_icnet_0.5_1025_resnet_v1\saved_model\ --output MODEL.onnx
    
     - WARNING - From C:\Users\esarojp\AppData\Local\Continuum\anaconda3\lib\site-packages\tf2onnx\verbose_logging.py:72: The name tf.logging.set_verbosity is deprecated. Please use tf.compat.v1.logging.set_verbosity instead.
    
    Traceback (most recent call last):
      File "C:\Users\esarojp\AppData\Local\Continuum\anaconda3\lib\runpy.py", line 193, in _run_module_as_main
        "__main__", mod_spec)
      File "C:\Users\esarojp\AppData\Local\Continuum\anaconda3\lib\runpy.py", line 85, in _run_code
        exec(code, run_globals)
      File "C:\Users\esarojp\AppData\Local\Continuum\anaconda3\lib\site-packages\tf2onnx\convert.py", line 161, in <module>
        main()
      File "C:\Users\esarojp\AppData\Local\Continuum\anaconda3\lib\site-packages\tf2onnx\convert.py", line 123, in main
        args.saved_model, args.inputs, args.outputs, args.signature_def)
      File "C:\Users\esarojp\AppData\Local\Continuum\anaconda3\lib\site-packages\tf2onnx\loader.py", line 103, in from_saved_model
        meta_graph_def = tf.saved_model.loader.load(sess, [tf.saved_model.tag_constants.SERVING], model_path)
      File "C:\Users\esarojp\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\util\deprecation.py", line 324, in new_func
        return func(*args, **kwargs)
      File "C:\Users\esarojp\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\saved_model\loader_impl.py", line 269, in load
        return loader.load(sess, tags, import_scope, **saver_kwargs)
      File "C:\Users\esarojp\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\saved_model\loader_impl.py", line 422, in load
        **saver_kwargs)
      File "C:\Users\esarojp\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\saved_model\loader_impl.py", line 349, in load_graph
        meta_graph_def = self.get_meta_graph_def_from_tags(tags)
      File "C:\Users\esarojp\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\saved_model\loader_impl.py", line 327, in get_meta_graph_def_from_tags
        "\navailable_tags: " + str(available_tags))
    RuntimeError: MetaGraphDef associated with tags 'serve' could not be found in SavedModel. To inspect available tag-sets in the SavedModel, please use the SavedModel CLI: `saved_model_cli`
    available_tags: [set()]
    

    and when I run:

    C:\Users\esarojp\Desktop\newmodel\0818_icnet_0.5_1025_resnet_v1.tar> saved_model_cli show --dir .\0818_icnet_0.5_1025_resnet_v1\saved_model\ --tag_set serve  --signature_def serving_default
    Traceback (most recent call last):
      File "C:\Users\esarojp\AppData\Local\Continuum\anaconda3\Scripts\saved_model_cli-script.py", line 10, in <module>
        sys.exit(main())
      File "C:\Users\esarojp\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\tools\saved_model_cli.py", line 909, in main
        args.func(args)
      File "C:\Users\esarojp\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\tools\saved_model_cli.py", line 621, in show
        _show_inputs_outputs(args.dir, args.tag_set, args.signature_def)
      File "C:\Users\esarojp\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\tools\saved_model_cli.py", line 133, in _show_inputs_outputs
        tag_set)
      File "C:\Users\esarojp\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\tools\saved_model_utils.py", line 120, in get_meta_graph_def
        ' could not be found in SavedModel')
    RuntimeError: MetaGraphDef associated with tag-set serve could not be found in SavedModel
    
    

    Any idea of what is wrong?

    opened by SiR0N 5
  • Stage 2 - Compression and Retraining

    Stage 2 - Compression and Retraining

    Hi, I follow the Documentation step by step, from training PSPNet to re-training ICNet . Everything works fine until the last step, When i re-train ICNet after compress ICNet , it shows the problem as below.

    INFO:tensorflow:Error reported to Coordinator: <class 'tensorflow.python.framework.errors_impl.InvalidArgumentError'>, Assign requires shapes of both tensors to match. lhs shape= [1,1,256,3] rhs shape= [1,1,512,3]
    [[Node: save/Assign_1 = Assign[T=DT_FLOAT, _class=["loc:@CascadeFeatureFusion_0/AuxOutput/weights"], use_locking=true, validate_shape=true, _device="/job:localhost/replica:0/task:0/device:CPU:0"](CascadeFeatureFusion_0/AuxOutput/weights, save/RestoreV2:1)]]
    

    it seems like after ICNet get compress by filter=0.5, some layer in model can't match anymore. Or maybe this is an issue of tensorflow slim.

    Caused by op u'save/Assign_1', defined at:
      File "train_mem_saving.py", line 192, in <module>
        tf.app.run()
      File "/home/idata/anaconda3/envs/fastSS_1/lib/python2.7/site-packages/tensorflow/python/platform/app.py", line 126, in run
        _sys.exit(main(argv))
      File "train_mem_saving.py", line 188, in main
        gradient_checkpoints=checkpoint_nodes)
      File "/home/idata/LDM/test/fast-semantic-segmentation/libs/trainer.py", line 217, in train_segmentation_model
        ignore_missing_vars=True)
      File "/home/idata/anaconda3/envs/fastSS_1/lib/python2.7/site-packages/tensorflow/contrib/framework/python/ops/variables.py", line 689, in assign_from_checkpoint_fn
        write_version=saver_pb2.SaverDef.V1)
      File "/home/idata/anaconda3/envs/fastSS_1/lib/python2.7/site-packages/tensorflow/python/training/saver.py", line 1338, in __init__
        self.build()
      File "/home/idata/anaconda3/envs/fastSS_1/lib/python2.7/site-packages/tensorflow/python/training/saver.py", line 1347, in build
        self._build(self._filename, build_save=True, build_restore=True)
      File "/home/idata/anaconda3/envs/fastSS_1/lib/python2.7/site-packages/tensorflow/python/training/saver.py", line 1384, in _build
        build_save=build_save, build_restore=build_restore)
      File "/home/idata/anaconda3/envs/fastSS_1/lib/python2.7/site-packages/tensorflow/python/training/saver.py", line 835, in _build_internal
        restore_sequentially, reshape)
      File "/home/idata/anaconda3/envs/fastSS_1/lib/python2.7/site-packages/tensorflow/python/training/saver.py", line 494, in _AddRestoreOps
        assign_ops.append(saveable.restore(saveable_tensors, shapes))
      File "/home/idata/anaconda3/envs/fastSS_1/lib/python2.7/site-packages/tensorflow/python/training/saver.py", line 185, in restore
        self.op.get_shape().is_fully_defined())
      File "/home/idata/anaconda3/envs/fastSS_1/lib/python2.7/site-packages/tensorflow/python/ops/state_ops.py", line 283, in assign
        validate_shape=validate_shape)
      File "/home/idata/anaconda3/envs/fastSS_1/lib/python2.7/site-packages/tensorflow/python/ops/gen_state_ops.py", line 60, in assign
        use_locking=use_locking, name=name)
      File "/home/idata/anaconda3/envs/fastSS_1/lib/python2.7/site-packages/tensorflow/python/framework/op_def_library.py", line 787, in _apply_op_helper
        op_def=op_def)
      File "/home/idata/anaconda3/envs/fastSS_1/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 3392, in create_op
        op_def=op_def)
      File "/home/idata/anaconda3/envs/fastSS_1/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 1718, in __init__
        self._traceback = self._graph._extract_stack()  # pylint: disable=protected-access
    
    
    opened by JanLin0817 5
  •  some questions about training

    some questions about training

    Thanks for your project. I have some questions.

    1. Where is the 953 file? This file is mentioned in Icnet.md. image I always get some errors in the first stage of training without it.
    2. I haven't read the code in detail. If I just use 5 classes of cityscapes to train. Do I only need to change the variable classes in config to 5? 3.I tried train from scratch using hellochick/ICNet-tensorflow(https://github.com/hellochick/ICNet-tensorflow) and the result was bad. I found your answers there. So if i train 5-classes-segmentation from 0818_pspnet_1.0_713_resnet_v1,will I get a good result? Thank you and look forward to your reply.
    opened by Jerry2990 4
  • No module named 'graph_utils'

    No module named 'graph_utils'

    oandrienko:

    Thanks for your nice work on this.

    I am following the instructions on "Training ICNet with Tensorflow", in Stage 2 - Compression and Retraining, I got and error as below while trying to run script python3 compress.py...

    File "/home/work/×××/fast-semantic-segmentation/libs/filter_pruner.py", line 24, in <module> from graph_utils import GraphTraversalState ModuleNotFoundError: No module named 'graph_utils'

    I tried to comment out LINE24, and re-run the script, and it gave me following errors...

    Traceback (most recent call last):
      File "compress.py", line 103, in <module>
        tf.app.run()
      File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/platform/app.py", line 124, in run
        _sys.exit(main(argv))
      File "compress.py", line 96, in main
        compressor.compress(FLAGS.input_checkpoint)
      File "/home/work/***/fast-semantic-segmentation/libs/filter_pruner.py", line 378, in compress
        self.neighbors = self._create_adjacency_list(self.output_node)
      File "/home/work/***/fast-semantic-segmentation/libs/filter_pruner.py", line 110, in _create_adjacency_list
        output_node = self.nodes_map[output_node_name]
    KeyError: 'Predictions/postrain/Conv2D'
    

    I am using python3.6.7 and tensorflow1.5.0 with CUDA9.1.

    Any suggestion on how to fix this kind of issues? Thanks in advance.

    opened by zoeveryday 4
  • Lower input size model

    Lower input size model

    Is there a lower input size model available? Will it help with faster inference if the image size is reduced? How do I go about training on lower resolution images, what are the changes required in the model?

    opened by heethesh 3
  • Training time

    Training time

    Hello,

    I wonder, what's the training time, both for PSPNet baseline and ICNet. I am running PSPNet training at the moment, it looks like it takes ~3 days. Does that sound right?

    opened by dmitrii-marin 3
  • Pre-train model for evaluation?

    Pre-train model for evaluation?

    Dear oandrienko,

    Thanks for your code ,

    1. Could you upload your trained model for evaluation?
    2. Inference.py:100, output_channels is not defined in code. If setting output_channels=1, the gray result was showed in the result. If setting output_channels!=1. raise TypeError("Cannot handle this data type") on line 102 "im = Image.fromarray(predictions)"

    Thanks

    opened by Minotaur-CN 3
  • Error while loading checkpoint when training

    Error while loading checkpoint when training

    I have to train ICNet on Camvid dataset. I initialize the network with classification weights of the ResNet with a single stage training.

    I set .config file and train_mem_saving.py input arguments as specified in https://github.com/oandrienko/fast-semantic-segmentation/blob/master/docs/icnet.md.

    When initializing the model from the checkpoint "tmp/resnet_v1_50.ckpt", I get this error:

    "Restoring from checkpoint failed. This is most likely due to a Variable name or other graph key that is missing from the checkpoint. Please ensure that you have not altered the graph expected based on the checkpoint. Original error: Key AuxOutput/biases not found in checkpoint [[node save_1/RestoreV2 (defined at /content/libs/trainer.py:286) ]]".

    It is strange since it sholdn't try to load variable 'AuxOutput/biases', since it does not belong to ResNet checkpoint. I correctly set 'fine_tune_checkpoint_type' to 'classification' in .config file.

    I am running the project on Google Colab which supports which supports tensorflow versions only greater than 1.13.1. Has anyone successfully run the project with these versions of tf?

    Thank you in advance

    opened by ManoniLo 0
  • Consult for help

    Consult for help

    Hello,

    In the section of Dataset formatting, there is this line:

    must have $CITYSCAPES_ROOT defined

    How to define the root. Every time I try running i get an error ERROR: Did not find any files. Please consult the README.

    opened by zhengjie6 2
  • MORE INFO ON LICENSE

    MORE INFO ON LICENSE

    Can u provide more info on license "Example providing MIT license ", mentioning openness for reuse even commercially, like usage of this trained model for inference in a Software without restriction, limitation to use, copy, modify, merge, publish, distribute etc etc.. current license by citation is not clear

    opened by kmsgnnew 0
  • ImportError: cannot import name 'hyperparams_pb2'

    ImportError: cannot import name 'hyperparams_pb2'

    When I finish compiling it appears to get protos,I get erros: Traceback (most recent call last): File "train_mem_saving.py", line 39, in from builders import model_builder File "/home/sherry/cuimiao/Fabric_defect_detection/fast-semantic-segmentation/builders/model_builder.py", line 8, in from builders import hyperparams_builder File "/home/sherry/cuimiao/Fabric_defect_detection/fast-semantic-segmentation/builders/hyperparams_builder.py", line 9, in from protos import hyperparams_pb2 ImportError: cannot import name 'hyperparams_pb2'

    opened by shakey-cuimiao 0
Owner
Oles Andrienko
Oles Andrienko
Real-Time-Student-Attendence-System - Real Time Student Attendence System

Real-Time-Student-Attendence-System The Student Attendance Management System Pro

Rounak Das 1 Feb 15, 2022
HyperSeg: Patch-wise Hypernetwork for Real-time Semantic Segmentation Official PyTorch Implementation

: We present a novel, real-time, semantic segmentation network in which the encoder both encodes and generates the parameters (weights) of the decoder. Furthermore, to allow maximal adaptivity, the weights at each decoder block vary spatially. For this purpose, we design a new type of hypernetwork, composed of a nested U-Net for drawing higher level context features

Yuval Nirkin 182 Dec 14, 2022
FANet - Real-time Semantic Segmentation with Fast Attention

FANet Real-time Semantic Segmentation with Fast Attention Ping Hu, Federico Perazzi, Fabian Caba Heilbron, Oliver Wang, Zhe Lin, Kate Saenko , Stan Sc

Ping Hu 42 Nov 30, 2022
DFFNet: An IoT-perceptive Dual Feature Fusion Network for General Real-time Semantic Segmentation

DFFNet Paper DFFNet: An IoT-perceptive Dual Feature Fusion Network for General Real-time Semantic Segmentation. Xiangyan Tang, Wenxuan Tu, Keqiu Li, J

null 4 Sep 23, 2022
Recall Loss for Semantic Segmentation (This repo implements the paper: Recall Loss for Semantic Segmentation)

Recall Loss for Semantic Segmentation (This repo implements the paper: Recall Loss for Semantic Segmentation) Download Synthia dataset The model uses

null 32 Sep 21, 2022
Semantic Segmentation for Real Point Cloud Scenes via Bilateral Augmentation and Adaptive Fusion (CVPR 2021)

Semantic Segmentation for Real Point Cloud Scenes via Bilateral Augmentation and Adaptive Fusion (CVPR 2021) This repository is for BAAF-Net introduce

null 90 Dec 29, 2022
Official Tensorflow implementation of "M-LSD: Towards Light-weight and Real-time Line Segment Detection"

M-LSD: Towards Light-weight and Real-time Line Segment Detection Official Tensorflow implementation of "M-LSD: Towards Light-weight and Real-time Line

NAVER/LINE Vision 357 Jan 4, 2023
Learning Pixel-level Semantic Affinity with Image-level Supervision for Weakly Supervised Semantic Segmentation, CVPR 2018

Learning Pixel-level Semantic Affinity with Image-level Supervision This code is deprecated. Please see https://github.com/jiwoon-ahn/irn instead. Int

Jiwoon Ahn 337 Dec 15, 2022
Tensorflow 2.x implementation of Panoramic BlitzNet for object detection and semantic segmentation on indoor panoramic images.

Deep neural network for object detection and semantic segmentation on indoor panoramic images. The implementation is based on the papers:

Alejandro de Nova Guerrero 9 Nov 24, 2022
Use tensorflow to implement a Deep Neural Network for real time lane detection

LaneNet-Lane-Detection Use tensorflow to implement a Deep Neural Network for real time lane detection mainly based on the IEEE IV conference paper "To

MaybeShewill-CV 1.9k Jan 8, 2023
An example of semantic segmentation using tensorflow in eager execution.

Semantic segmentation using Tensorflow eager execution Requirement Python 2.7+ Tensorflow-gpu OpenCv H5py Scikit-learn Numpy Imgaug Train with eager e

Iñigo Alonso Ruiz 25 Sep 29, 2022
Segmentation in Style: Unsupervised Semantic Image Segmentation with Stylegan and CLIP

Segmentation in Style: Unsupervised Semantic Image Segmentation with Stylegan and CLIP Abstract: We introduce a method that allows to automatically se

Daniil Pakhomov 134 Dec 19, 2022
TorchDistiller - a collection of the open source pytorch code for knowledge distillation, especially for the perception tasks, including semantic segmentation, depth estimation, object detection and instance segmentation.

This project is a collection of the open source pytorch code for knowledge distillation, especially for the perception tasks, including semantic segmentation, depth estimation, object detection and instance segmentation.

yifan liu 147 Dec 3, 2022
YolactEdge: Real-time Instance Segmentation on the Edge

YolactEdge, the first competitive instance segmentation approach that runs on small edge devices at real-time speeds. Specifically, YolactEdge runs at up to 30.8 FPS on a Jetson AGX Xavier (and 172.7 FPS on an RTX 2080 Ti) with a ResNet-101 backbone on 550x550 resolution images.

Haotian Liu 1.1k Jan 6, 2023
OrienMask: Real-time Instance Segmentation with Discriminative Orientation Maps

OrienMask This repository implements the framework OrienMask for real-time instance segmentation. It achieves 34.8 mask AP on COCO test-dev at the spe

null 45 Dec 13, 2022
implement of SwiftNet:Real-time Video Object Segmentation

SwiftNet The official PyTorch implementation of SwiftNet:Real-time Video Object Segmentation, which has been accepted by CVPR2021. Requirements Python

haochen wang 64 Dec 14, 2022
A keras-based real-time model for medical image segmentation (CFPNet-M)

CFPNet-M: A Light-Weight Encoder-Decoder Based Network for Multimodal Biomedical Image Real-Time Segmentation This repository contains the implementat

null 268 Nov 27, 2022