Train DeepLab for Semantic Image Segmentation

Overview

Train DeepLab for Semantic Image Segmentation

Martin Kersner, [email protected]

This repository contains scripts for training DeepLab for Semantic Image Segmentation using strongly and weakly annotated data. Semantic Image Segmentation with Deep Convolutional Nets and Fully Connected CRFs and Weakly- and Semi-Supervised Learning of a DCNN for Semantic Image Segmentation papers describe training procedure using strongly and weakly annotated data, respectively.

git clone --recursive https://github.com/martinkersner/train-DeepLab.git 

In following tutorial we use couple of shell variables in order to reproduce the same results without any obtacles.

  • $DEEPLAB denotes the main directory where repository is checked out
  • $DATASETS denotes path to directory where all necessary datasets are stored
  • $LOGNAME denotes name of log file stored in $DEEPLAB/exper/voc12/log directory
  • $DOWNLOADS denotes directory where downloaded files are stored

Prerequisites

Install DeepLab caffe

You should follow instructions for installation. However, if you have already fulfilled all necessary dependencies running following commands from code/ directory should do the job.

cd $DEEPLAB/code
cp Makefile.config.example Makefile.config
# Adjust Makefile.config (for example, if using Anaconda Python, or if cuDNN is desired)
make all
make pycaffe
make test # NOT mandatory
make runtest # NOT mandatory

Compile DenseCRF

Go to $DEEPLAB/code/densecrf directory, modify Makefile if necessary and run make command. Or you can run following commands in sequential order.

cd $DEEPLAB/code/densecrf
# Adjust Makefile if necessary
make

Strong annotations

In this part of tutorial we train DCNN for semantic image segmentation using PASCAL VOC dataset with all 21 classes and also with limited number of them. As a training data we use only strong annotations (pixel level labels).

Dataset

All necessary data for training are listed in $DEEPLAB/exper/voc12/list/original. Training scripts are prepared to employ either PASCAL VOC 2012 dataset or augmented PASCAL VOC dataset which contains more images.

# augmented PASCAL VOC
cd $DATASETS
wget http://www.eecs.berkeley.edu/Research/Projects/CS/vision/grouping/semantic_contours/benchmark.tgz # 1.3 GB
tar -zxvf benchmark.tgz
mv benchmark_RELEASE VOC_aug

# original PASCAL VOC 2012
wget http://host.robots.ox.ac.uk/pascal/VOC/voc2012/VOCtrainval_11-May-2012.tar # 2 GB
tar -xvf VOCtrainval_11-May-2012.tar
mv VOCdevkit/VOC2012 VOC2012_orig && rm -r VOCdevkit

Data conversions

Unfortunately, ground truth labels within augmented PASCAL VOC dataset are distributed as Matlab data files, therefore we will have to convert them before we can start training itself.

cd $DATASETS/VOC_aug/dataset
mkdir cls_png
cd $DEEPLAB
./mat2png.py $DATASETS/VOC_aug/dataset/cls $DATASETS/VOC_aug/dataset/cls_png

Caffe softmax loss function can accept only one-channel ground truth labels. However, those labels in original PASCAL VOC 2012 dataset are defined as RGB images. Thus, we have to reduce their dimensionality.

cd $DATASETS/VOC2012_orig
mkdir SegmentationClass_1D

cd $DEEPLAB
./convert_labels.py $DATASETS/VOC2012_orig/SegmentationClass/ \
  $DATASETS/VOC2012_orig/ImageSets/Segmentation/trainval.txt \
  $DATASETS/VOC2012_orig/SegmentationClass_1D/

At last, part of code which computes DenseCRF is able to work only with PPM image files, hence we have to perform another conversion. This step is necessary only if we want to use DenseCRF separately and as one of Caffe layers.

cd $DEEPLAB

# augmented PASCAL VOC
mkdir $DATASETS/VOC_aug/dataset/img_ppm
./jpg2ppm.sh $DATASETS/VOC_aug/dataset/img $DATASETS/VOC_aug/dataset/img_ppm

# original PASCAL VOC 2012
mkdir $DATASETS/VOC2012_orig/PPMImages
./jpg2ppm.sh $DATASETS/VOC2012_orig/JPEGImages $DATASETS/VOC2012_orig/PPMImages

Connect $DATASETS into $DEEPLAB

Then we create symbolic links to training images and ground truth labels.

mkdir -p $DEEPLAB/exper/voc12/data
cd $DEEPLAB/exper/voc12/data

# augmented PASCAL VOC
ln -s $DATASETS/VOC_aug/dataset/img images_aug
ln -s $DATASETS/VOC_aug/dataset/cls_png labels_aug
ln -s $DATASETS/VOC_aug/dataset/img_ppm images_aug_ppm

# original PASCAL VOC 2012
ln -s $DATASETS/VOC2012_orig/JPEGImages images_orig
ln -s $DATASETS/VOC2012_orig/SegmentationClass_1D labels_orig
ln -s $DATASETS/VOC2012_orig/PPMImages images_orig_ppm

Download necessary files for training

Before the first training we have to download several files. Using the command below we download initialization model, definition its network and solver. It will also setup symbolic links in directories where those files are later expected during training.

./get_DeepLab_LargeFOV_voc12_data.sh

In order to easily switch between datasets we will modify image lists appropriately.

./prepare_voc12_data_lists.sh

Training with all classes

run_pascal_strong.sh can go through 4 different phases (twice training, twice testing), but I wouldn't recommend to run testing phases using this script. Actually, they are currently disabled. At lines 27 through 30, any of phase can be enabled (value 1) or disabled (value 0).

Finally, we can start training.

./run_pascal_strong.sh

Plotting training information

Training script generates information which are printed to terminal and also stored in $DEEPLAB/exper/voc12/log/DeepLab-LargeFOV/ directory. For every printed iteration there are displayed loss and three different model evalutation metrics for currently employed batch. They denote pixel accuracy, average recall and average Jacard index, respectively. Even though those values are retrievd from training data, they possess important information about training and using the script below we can plot them as a graph. The script generates two graphs evaluation.png and loss.png.

cd $DEEPLAB
./loss_from_log.py exper/voc12/log/DeepLab-LargeFOV/`ls -t exper/voc12/log/DeepLab-LargeFOV/ | head -n 1` # for the newest log
#./loss_from_log.py exper/voc12/log/DeepLab-LargeFOV/$LOGNAME # specified log 

Training with only 3 classes

If we want to train with limited number of classes we have to modify ground truth labels and also list of images that can be exploited for training. In filter_images.py at line 17 are specified classes that we are interested in (defaultly bird, bottle and chair).

# augmented PASCAL VOC 
mkdir -p $DATASETS/VOC_aug/dataset/cls_sub_png
cd $DEEPLAB/exper/voc12/data/
ln -s $DATASETS/VOC_aug/dataset/cls_sub_png labels_sub_aug
find exper/voc12/data/labels_aug/ -printf '%f\n' | sed 's/\.png//'  | tail -n +2 > all_aug_data.txt
python filter_images.py $DATASETS/VOC_aug/dataset/cls_png/ $DATASETS/VOC_aug/dataset/cls_sub_png/ all_aug_data.txt sub_aug_data.txt

# original PASCAL VOC 2012 
mkdir -p $DATASETS/VOC2012_orig/SegmentationClass_sub_1D
cd $DEEPLAB/exper/voc12/data/
ln -s $DATASETS/VOC2012_orig/SegmentationClass_sub_1D labels_sub_orig
find exper/voc12/data/labels_orig/ -printf '%f\n' | sed 's/\.png//'  | tail -n +2 > all_orig_data.txt
python filter_images.py $DATASETS/VOC2012_orig/SegmentationClass_1D/ $DATASETS/VOC2012_orig/SegmentationClass_sub_1D/ all_orig_data.txt sub_orig_data.txt

./filter_lists.sh

The number of classes that we plan to use is set at lines 13 and 14 in run_pascal_strong.sh. This number should be always higher by 1 than number of specified classes in filter_images.py script, because we also consider background as one of classes.

After, we can proceed to training.

./run_pascal_strong.sh

We can also use the same script for plotting training information.

Evaluation

phase 1 (24,000 iter., no CRF) phase 2 (12,000 iter., no CRF)
pixel accuracy 0.8315 0.8523
mean accuracy 0.6807 0.6987
mean IU 0.6725 0.6937
frequency weighted IU 0.8182 0.8439

Visual results

Employed model was trained without CRF in phase 1 (24,000 iterations) and then in phase 2 (12,000 iterations), but results here exploited DENSE_CRF layer. Displayed images (bird: 2010_004994, bottle: 2007_000346, chair: 2008_000673) are part of validation dataset stored in $DEEPLAB/exper/voc12/list_subset/val.txt. Colors of segments differ from original ground truth labels because employed model was trained only for 3 classes + background.

Weak annotations

In a case we don't possess enough training data, weakly annotated ground truth labels can be exploited using DeepLab.

Dataset

At first you should download SegmentationClassBboxRect_Visualization.zip and SegmentationClassBboxSeg_Visualization.zip from link https://ucla.app.box.com/s/laif889j7pk6dj04b0ou1apm2sgub9ga and run commands below to prepare data for use.

cd $DOWNLOADS
mv SegmentationClassBboxRect_Visualization.zip $DATASETS/VOC_aug/dataset/
mv SegmentationClassBboxSeg_Visualization.zip $DATASETS/VOC_aug/dataset/

cd $DATASETS/VOC_aug/dataset
unzip SegmentationClassBboxRect_Visualization.zip
unzip SegmentationClassBboxSeg_Visualization.zip

mv SegmentationClassBboxAug_Visualization/ SegClassBboxAug_RGB
mv SegmentationClassBboxErode20CRFAug_Visualization/ SegClassBboxErode20CRFAug_RGB

Downloaded weak annotations were created using Matlab and because of that labels are sometimes stored with one channel and other times with three channels. Similarly to strong annotations we have to convert all labels to the same one channel format. In order to cope with it I recommend you to use Matlab script convert_weak_labels.m (if anybody knows how to perform the same conversion using python I would be really interested) which is stored in $DEEPLAB directory. Before running script you have to specify path to datasets on line 3.

After script successfully finished we have to create symbolic links to be able to reach data during training.

cd $DEEPLAB/exper/voc12/data
ln -s $DATASETS/VOC_aug/dataset/SegClassBboxAug_1D/ labels_bbox
ln -s $DATASETS/VOC_aug/dataset/SegClassBboxErode20CRFAug_1D/ labels_bboxcrf

Create subsets

Training DeepLab using weak labels enables to employ datasets of different sizes. Following snippet creates those subsets of strong dataset and also necessary training lists with weak labels.

cd $DEEPLAB
./create_weak_lists.sh

cd $DEEPLAB/exper/voc12/list
head -n 200  train.txt > train200.txt
head -n 500  train.txt > train500.txt
head -n 750  train.txt > train750.txt
head -n 1000 train.txt > train1000.txt

cp train_bboxcrf.txt trainval_bboxcrf.txt
cp train_bbox.txt trainval_bbox.txt

Training

Training using weak annotations is similar to exploiting strong annotations. The only difference is the name of script which should be run.

./run_pascal_weak.sh

Plotting is also same as for strong annotations.

Evaluation

5000 weak annotations and 200 strong annotations

phase 1 (6,000 iter., no CRF) phase 2 (8,000 iter., no CRF)
pixel accuracy 0.8688 0.8671
mean accuracy 0.7415 0.750
mean IU 0.6324 0.6343
frequency weighted IU 0.7962 0.7951

Note

Init models are modified VGG-16 networks with changed kernel size from 7x7 to 4x4 or 3x3. There are two models that can be employed for initialization: vgg16_128, vgg16_20M.

The first fully connected layer of vgg16_128 has kernel size 4x4 and 4096 filters. It can be used for DeepLab basic model. In vgg16_20M, the first fully connected layer has kernel size 3x3 and 1024 filters. It can be used for DeepLab-LargeFOV.

Currently training is focused on DeepLab-LargeFOV.

FAQ

At http://ccvl.stat.ucla.edu/deeplab_faq/ you can find frequently asked questions about DeepLab for semantic image segmentation.

Comments
  • MIT or Apache v2 license?

    MIT or Apache v2 license?

    any chance you could add a license to this project?

    Suggestions:

    • MIT
      • about MIT: https://tldrlegal.com/license/mit-license
    • Apache v2
      • about Apache v2: https://tldrlegal.com/license/apache-license-2.0-(apache-2.0)
    opened by ahundt 8
  • How to run deeplab.py?

    How to run deeplab.py?

    I want to run deeplab.py to show the result image. And I use model 'vgg16_20M.caffemodel ' or 'train2_iter_8000.caffemodel' (download from the DeepLab models)and net 'deploy21.prototxt' in your project.But there is an error: F0705 22:14:09.639734 19135 layer.hpp:378] Check failed: ExactNumTopBlobs() == top.size() (2 vs. 3) MEMORY_DATA Layer produces 2 top blob(s) as output. Did I use the wrong deploy.prototxt or model?

    opened by koizora223 6
  • Wrong prediction results?

    Wrong prediction results?

    Hi @martinkersner I run deeplab.py using the downloaded official caffemodel(train2_iter_8000.caffemodel). But I get wrong results.The object seems to locate in the wrong position. I have checked the output of each layer and found the output of fully connected layer fc6 incorrect. There are my results.Please give me some advices.Thanks!! c-label

    a-label

    Chen

    opened by koizora223 5
  • How to generate the label image?

    How to generate the label image?

    Hi Martin, I found your tutorial very help and I am following it to train a model. A quick question: do you have code snippet to generate the label image, like this one in your tutorial? Thanks.

    https://camo.githubusercontent.com/4df6f507fe1ec20b526af294eeadc482e0f4bf1e/687474703a2f2f692e696d6775722e636f6d2f6e35507a765a552e706e673f31

    opened by fengjunlv 5
  • convert_labels.py warnings

    convert_labels.py warnings

    Hello,

    When I want to convert my RGB labels to 1D labels, I get such warnings for each PNG file:

    /usr/local/lib/python2.7/dist-packages/skimage/io/_io.py:132: UserWarning: train/0257.png is a low contrast image
      warn('%s is a low contrast image' % fname)
    

    and when I check the PNG files, they are black.

    may I ask you what this conversion does actually and the reason of this warning and black PNG labels?

    opened by MyVanitar 4
  • Problem with mat2png.py

    Problem with mat2png.py

    Hello,

    I am using python 2.7.When i tried to run mat2png.py,it shows,

    KeyError: 'GTcls' and it is right as the function mat2png_hariharan in utils.py,is not assigning the key to the output.I tried may[key]=loadmat....,but still mat[key].Segmentation throws error.Any thoughts will be useful
    
    opened by srika91 4
  • Fast version of convert_from_color_segmentation

    Fast version of convert_from_color_segmentation

    Hi, minor improvement here, but it might be useful to other people that want to convert the VOC2012 segmentation masks to 1D images; using a vectorized numpy form saves lots of time (10-fold improvement).

    opened by bermanmaxim 1
  • Error while compiling using make

    Error while compiling using make

    I'm following the installation guide, and after I do "make all" I get the following error, which I suspect is from some issue with matio, although it is properly installed and I can access it via dpkg:

    [ 88%] Building CXX object tools/CMakeFiles/caffe.bin.dir/caffe.cpp.o Linking CXX executable caffe ../lib/libcaffe.a(blob.cpp.o): In function caffe::Blob<float>::FromMat(char const*)': blob.cpp:(.text._ZN5caffe4BlobIfE7FromMatEPKc[_ZN5caffe4BlobIfE7FromMatEPKc]+0x3d): undefined reference toMat_Open' blob.cpp:(.text._ZN5caffe4BlobIfE7FromMatEPKc[_ZN5caffe4BlobIfE7FromMatEPKc]+0x117): undefined reference to Mat_VarReadInfo' blob.cpp:(.text._ZN5caffe4BlobIfE7FromMatEPKc[_ZN5caffe4BlobIfE7FromMatEPKc]+0x477): undefined reference toMat_VarReadDataLinear' blob.cpp:(.text._ZN5caffe4BlobIfE7FromMatEPKc[_ZN5caffe4BlobIfE7FromMatEPKc]+0x548): undefined reference to Mat_VarFree' blob.cpp:(.text._ZN5caffe4BlobIfE7FromMatEPKc[_ZN5caffe4BlobIfE7FromMatEPKc]+0x55e): undefined reference toMat_VarReadInfo' blob.cpp:(.text._ZN5caffe4BlobIfE7FromMatEPKc[_ZN5caffe4BlobIfE7FromMatEPKc]+0x6b0): undefined reference to Mat_VarReadDataLinear' blob.cpp:(.text._ZN5caffe4BlobIfE7FromMatEPKc[_ZN5caffe4BlobIfE7FromMatEPKc]+0x781): undefined reference toMat_VarFree' blob.cpp:(.text._ZN5caffe4BlobIfE7FromMatEPKc[_ZN5caffe4BlobIfE7FromMatEPKc]+0x790): undefined reference to `Mat_Close'

    Have you come across this error, and if so how did you get around it? Thanks.

    opened by nk-dev0 1
  • train failure

    train failure

    train.prototxt layers { name: "data" type: IMAGE_SEG_DATA top: "data" top: "label" image_data_param { root_folder: "/media/hao/DATA/DataSet/VOC2012" source: "voc12/list/train.txt" label_type: PIXEL batch_size: 20 shuffle: true } transform_param { mean_value: 104.008 mean_value: 116.669 mean_value: 122.675 crop_size: 306 mirror: true } include: { phase: TRAIN } }

    When run " ./run_pascal.sh" for train, it get the error:[libprotobuf ERROR google/protobuf/text_format.cc:288] Error parsing text-format caffe.NetParameter: 21:3: Unknown enumeration value of "IMAGE_SEG_DATA" for field "type". The "IMAGE_SEG_DATA" layer exists in the source code.

    opened by smartadpole 0
  • how to add BN layers to this version?

    how to add BN layers to this version?

    I meet this error when I try to add BN layer to this version:

    In file included from src/caffe/layers/batch_norm_layer.cpp:4:0:
    ./include/caffe/layers/batch_norm_layer.hpp: In instantiation of ‘class caffe::BatchNormLayer<float>’:
    src/caffe/layers/batch_norm_layer.cpp:249:1:   required from here
    ./include/caffe/layers/batch_norm_layer.hpp:49:30: error: conflicting return type specified for ‘const char* caffe::BatchNormLayer<Dtype>::type() const [with Dtype = float]’
       virtual inline const char* type() const { return "BatchNorm"; }
    

    I really have no idea how to solve it because I believe it is correct.

    opened by MuseCP 0
  • Could not make pycaffe

    Could not make pycaffe

    Here is the error: make pycaffe find: matlab/+caffe/private': No such file or directory make: *** No rule to make targetinclude/caffe/layers/python_layer.hpp', needed by `python/c affe/_caffe.so'. Stop.

    It seems that there is not file in path of `include/caffe/layers/', so how can i download your caffe's version? Thanks!

    opened by ABadCandy 0
  • make test in nvidia-docker

    make test in nvidia-docker

    there is nothing wrong when i make all. but error in make test

    LD .build_release/src/caffe/test/test_euclidean_loss_layer.o LD .build_release/src/caffe/test/test_mvn_layer.o .build_release/src/caffe/test/test_contrastive_loss_layer.o: In function caffe::ContrastiveLossLayerTest_TestForward_Test<caffe::CPUDevice<float> >::TestBody()': test_contrastive_loss_layer.cpp:(.text._ZN5caffe41ContrastiveLossLayerTest_TestForward_TestINS_9CPUDeviceIfEEE8TestBodyEv[_ZN5caffe41ContrastiveLossLayerTest_TestForward_TestINS_9CPUDeviceIfEEE8TestBodyEv]+0x307): undefined reference tocaffe::ContrastiveLossParameter_default_instance' .build_release/src/caffe/test/test_contrastive_loss_layer.o: In function caffe::ContrastiveLossLayerTest_TestForward_Test<caffe::GPUDevice<float> >::TestBody()': test_contrastive_loss_layer.cpp:(.text._ZN5caffe41ContrastiveLossLayerTest_TestForward_TestINS_9GPUDeviceIfEEE8TestBodyEv[_ZN5caffe41ContrastiveLossLayerTest_TestForward_TestINS_9GPUDeviceIfEEE8TestBodyEv]+0x307): undefined reference tocaffe::ContrastiveLossParameter_default_instance' .build_release/src/caffe/test/test_contrastive_loss_layer.o: In function caffe::ContrastiveLossLayerTest_TestForwardLegacy_Test<caffe::CPUDevice<float> >::TestBody()': test_contrastive_loss_layer.cpp:(.text._ZN5caffe47ContrastiveLossLayerTest_TestForwardLegacy_TestINS_9CPUDeviceIfEEE8TestBodyEv[_ZN5caffe47ContrastiveLossLayerTest_TestForwardLegacy_TestINS_9CPUDeviceIfEEE8TestBodyEv]+0x336): undefined reference tocaffe::ContrastiveLossParameter_default_instance' .build_release/src/caffe/test/test_contrastive_loss_layer.o: In function caffe::ContrastiveLossLayerTest_TestForwardLegacy_Test<caffe::GPUDevice<float> >::TestBody()': test_contrastive_loss_layer.cpp:(.text._ZN5caffe47ContrastiveLossLayerTest_TestForwardLegacy_TestINS_9GPUDeviceIfEEE8TestBodyEv[_ZN5caffe47ContrastiveLossLayerTest_TestForwardLegacy_TestINS_9GPUDeviceIfEEE8TestBodyEv]+0x336): undefined reference tocaffe::ContrastiveLossParameter_default_instance' .build_release/src/caffe/test/test_contrastive_loss_layer.o: In function caffe::ContrastiveLossLayerTest_TestForward_Test<caffe::CPUDevice<double> >::TestBody()': test_contrastive_loss_layer.cpp:(.text._ZN5caffe41ContrastiveLossLayerTest_TestForward_TestINS_9CPUDeviceIdEEE8TestBodyEv[_ZN5caffe41ContrastiveLossLayerTest_TestForward_TestINS_9CPUDeviceIdEEE8TestBodyEv]+0x304): undefined reference tocaffe::ContrastiveLossParameter_default_instance' .build_release/src/caffe/test/test_contrastive_loss_layer.o:test_contrastive_loss_layer.cpp:(.text._ZN5caffe41ContrastiveLossLayerTest_TestForward_TestINS_9GPUDeviceIdEEE8TestBodyEv[_ZN5caffe41ContrastiveLossLayerTest_TestForward_TestINS_9GPUDeviceIdEEE8TestBodyEv]+0x304): more undefined references to caffe::_ContrastiveLossParameter_default_instance_' follow collect2: error: ld returned 1 exit status Makefile:620: recipe for target '.build_release/test/test_contrastive_loss_layer.testbin' failed make: *** [.build_release/test/test_contrastive_loss_layer.testbin] Error 1 make: *** Waiting for unfinished jobs.... .build_release/src/caffe/test/test_pooling_layer.o: In functioncaffe::PoolingLayer::MaxTopBlobs() const': test_pooling_layer.cpp:(.text._ZNK5caffe12PoolingLayerIfE11MaxTopBlobsEv[_ZNK5caffe12PoolingLayerIfE11MaxTopBlobsEv]+0x23): undefined reference to caffe::_PoolingParameter_default_instance_' .build_release/src/caffe/test/test_pooling_layer.o: In functioncaffe::PoolingLayer::MaxTopBlobs() const': test_pooling_layer.cpp:(.text._ZNK5caffe12PoolingLayerIdE11MaxTopBlobsEv[_ZNK5caffe12PoolingLayerIdE11MaxTopBlobsEv]+0x23): undefined reference to caffe::_PoolingParameter_default_instance_' collect2: error: ld returned 1 exit status Makefile:620: recipe for target '.build_release/test/test_pooling_layer.testbin' failed make: *** [.build_release/test/test_pooling_layer.testbin] Error 1 .build_release/src/caffe/test/test_rnn_layer.o: In functioncaffe::RecurrentLayer::ExactNumTopBlobs() const': test_rnn_layer.cpp:(.text._ZNK5caffe14RecurrentLayerIfE16ExactNumTopBlobsEv[_ZNK5caffe14RecurrentLayerIfE16ExactNumTopBlobsEv]+0xdb): undefined reference to caffe::_RecurrentParameter_default_instance_' .build_release/src/caffe/test/test_rnn_layer.o: In functioncaffe::RecurrentLayer::MinBottomBlobs() const': test_rnn_layer.cpp:(.text._ZNK5caffe14RecurrentLayerIfE14MinBottomBlobsEv[_ZNK5caffe14RecurrentLayerIfE14MinBottomBlobsEv]+0xdb): undefined reference to caffe::_RecurrentParameter_default_instance_' .build_release/src/caffe/test/test_rnn_layer.o: In functioncaffe::RecurrentLayer::ExactNumTopBlobs() const': test_rnn_layer.cpp:(.text._ZNK5caffe14RecurrentLayerIdE16ExactNumTopBlobsEv[_ZNK5caffe14RecurrentLayerIdE16ExactNumTopBlobsEv]+0xdb): undefined reference to caffe::_RecurrentParameter_default_instance_' .build_release/src/caffe/test/test_rnn_layer.o: In functioncaffe::RecurrentLayer::MinBottomBlobs() const': test_rnn_layer.cpp:(.text._ZNK5caffe14RecurrentLayerIdE14MinBottomBlobsEv[_ZNK5caffe14RecurrentLayerIdE14MinBottomBlobsEv]+0xdb): undefined reference to caffe::_RecurrentParameter_default_instance_' .build_release/src/caffe/test/test_rnn_layer.o: In functioncaffe::RecurrentLayer::MaxBottomBlobs() const': test_rnn_layer.cpp:(.text._ZNK5caffe14RecurrentLayerIdE14MaxBottomBlobsEv[_ZNK5caffe14RecurrentLayerIdE14MaxBottomBlobsEv]+0xf3): undefined reference to caffe::_RecurrentParameter_default_instance_' .build_release/src/caffe/test/test_rnn_layer.o:test_rnn_layer.cpp:(.text._ZNK5caffe14RecurrentLayerIfE14MaxBottomBlobsEv[_ZNK5caffe14RecurrentLayerIfE14MaxBottomBlobsEv]+0xf3): more undefined references tocaffe::RecurrentParameter_default_instance' follow collect2: error: ld returned 1 exit status Makefile:620: recipe for target '.build_release/test/test_rnn_layer.testbin' failed make: *** [.build_release/test/test_rnn_layer.testbin] Error 1

    looking forward your help

    opened by JeffC0628 0
  • How to adapt the model of vgg to init model?

    How to adapt the model of vgg to init model?

    In VGG, the first connected layer is 4096 7x7 filters, how to adapt these param to 3x3 1024 or 4x4 4096? Is it just copy parameters in order and remove the others? Thanks a lot.

    opened by pkuCactus 0
  • Different mean_iou on VOC12

    Different mean_iou on VOC12

    I tested resnet-101 successfully, but it's not the same as the author's miou. The result before densecrf on the validation set was 0.7646 and the paper was 0.7635. Strangely, the miou I ran out of VGG-16 was consistent with the paper. Does anyone have the same problem?

    opened by dingfg 1
  • errors on deeplab.py

    errors on deeplab.py

    I use deeplab to do segmentation.when I use deeplab.py I meet this error:

    Traceback (most recent call last):
      File "deeplab.py", line 106, in <module>
        main()
      File "deeplab.py", line 24, in main
        net = Segmenter(net_path, model_path, gpu_id)
      File "/home/muses/train-DeepLab/segmenter.py", line 17, in __init__
        caffe.Net.__init__(self, prototxt, model)
    Boost.Python.ArgumentError: Python argument types in
        Net.__init__(Segmenter, str, str)
    did not match C++ signature:
        __init__(boost::python::api::object, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int)
        __init__(boost::python::api::object, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > network_file, int phase, int level=0, boost::python::api::object stages=None, boost::python::api::object weights=None)
    

    my command is:

    python deeplab.py 0 ./exper/0822/config/PSP101-ele/pspnet101_ele_8s.prototxt ./exper/0822/model/model_iter_10000.caffemodel ./test/pic/87.png

    how to solve this problem?

    opened by MuseCP 1
  • Deeplab is predicting background only

    Deeplab is predicting background only

    Hi, I am try to reproduce the deeplab results using VOC2012 data set as described in instructions at https://bitbucket.org/aquariusjay/deeplab-public-ver2 I tried two approaches 1) using already trained model vgg16_20M.caffemodel and created a symoblic link of this model with name init.caffemodel in deeplab_largeFOV directory and fine tuned it secondly I tried to train without using init.caffemode. In first case training is going fine and prediction accuracies are good. But when i use second approach, i observe that only background class is predicted and test, evaluation phases show that only background class has some accuracy whereas all other classes are predicted to be zero. Can you please guide in this context. Best

    opened by sajjo79 0
Owner
Martin Kersner
Machine Learning Engineer
Martin Kersner
DeepLab resnet v2 model in pytorch

pytorch-deeplab-resnet DeepLab resnet v2 model implementation in pytorch. The architecture of deepLab-ResNet has been replicated exactly as it is from

Isht Dwivedi 601 Dec 22, 2022
Train neural network for semantic segmentation (deep lab V3) with pytorch in less then 50 lines of code

Train neural network for semantic segmentation (deep lab V3) with pytorch in 50 lines of code Train net semantic segmentation net using Trans10K datas

null 17 Dec 19, 2022
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
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
Mae segmentation - Reproduction of semantic segmentation using masked autoencoder (mae)

ADE20k Semantic segmentation with MAE Getting started Install the mmsegmentation

null 97 Dec 17, 2022
Exploring Cross-Image Pixel Contrast for Semantic Segmentation

Exploring Cross-Image Pixel Contrast for Semantic Segmentation Exploring Cross-Image Pixel Contrast for Semantic Segmentation, Wenguan Wang, Tianfei Z

Tianfei Zhou 510 Jan 2, 2023
A Comprehensive Analysis of Weakly-Supervised Semantic Segmentation in Different Image Domains (IJCV submission)

wsss-analysis The code of: A Comprehensive Analysis of Weakly-Supervised Semantic Segmentation in Different Image Domains, arXiv pre-print 2019 paper.

Lyndon Chan 48 Dec 18, 2022
A Strong Baseline for Image Semantic Segmentation

A Strong Baseline for Image Semantic Segmentation Introduction This project is an open source semantic segmentation toolbox based on PyTorch. It is ba

Clark He 49 Sep 20, 2022
ICCV2021 - Mining Contextual Information Beyond Image for Semantic Segmentation

Introduction The official repository for "Mining Contextual Information Beyond Image for Semantic Segmentation". Our full code has been merged into ss

null 55 Nov 9, 2022
An extremely simple, intuitive, hardware-friendly, and well-performing network structure for LiDAR semantic segmentation on 2D range image. IROS21

FIDNet_SemanticKITTI Motivation Implementing complicated network modules with only one or two points improvement on hardware is tedious. So here we pr

YimingZhao 54 Dec 12, 2022
A unet implementation for Image semantic segmentation

Unet-pytorch a unet implementation for Image semantic segmentation 参考网上的Unet做分割的代码,做了一个针对kaggle地盐识别的,请去以下地址获取数据集: https://www.kaggle.com/c/tgs-salt-id

Rabbit 3 Jun 29, 2022
Multi-atlas segmentation (MAS) is a promising framework for medical image segmentation

Multi-atlas segmentation (MAS) is a promising framework for medical image segmentation. Generally, MAS methods register multiple atlases, i.e., medical images with corresponding labels, to a target image;

NanYoMy 13 Oct 9, 2022
A curated list of awesome resources related to Semantic Search🔎 and Semantic Similarity tasks.

A curated list of awesome resources related to Semantic Search?? and Semantic Similarity tasks.

null 224 Jan 4, 2023
Build upon neural radiance fields to create a scene-specific implicit 3D semantic representation, Semantic-NeRF

Semantic-NeRF: Semantic Neural Radiance Fields Project Page | Video | Paper | Data In-Place Scene Labelling and Understanding with Implicit Scene Repr

Shuaifeng Zhi 243 Jan 7, 2023
Copy Paste positive polyp using poisson image blending for medical image segmentation

Copy Paste positive polyp using poisson image blending for medical image segmentation According poisson image blending I've completely used it for bio

Phạm Vũ Hùng 2 Oct 19, 2021
U-Net Implementation: Convolutional Networks for Biomedical Image Segmentation" using the Carvana Image Masking Dataset in PyTorch

U-Net Implementation By Christopher Ley This is my interpretation and implementation of the famous paper "U-Net: Convolutional Networks for Biomedical

Christopher Ley 1 Jan 6, 2022