Chainer Implementation of Fully Convolutional Networks. (Training code to reproduce the original result is available.)

Overview

fcn - Fully Convolutional Networks

PyPI Version Python Versions GitHub Actions

Chainer implementation of Fully Convolutional Networks.

Installation

pip install fcn

Inference

Inference is done as below:

# forwaring of the networks
img_file=https://farm2.staticflickr.com/1522/26471792680_a485afb024_z_d.jpg
fcn_infer.py --img-files $img_file --gpu -1 -o /tmp  # cpu mode
fcn_infer.py --img-files $img_file --gpu 0 -o /tmp   # gpu mode

Original Image: https://www.flickr.com/photos/faceme/26471792680/

Training

cd examples/voc
./download_datasets.py
./download_models.py

./train_fcn32s.py --gpu 0
# ./train_fcn16s.py --gpu 0
# ./train_fcn8s.py --gpu 0
# ./train_fcn8s_atonce.py --gpu 0

The accuracy of original implementation is computed with (evaluate.py) after converting the caffe model to chainer one using convert_caffe_to_chainermodel.py.
You can download vgg16 model from here: vgg16_from_caffe.npz.

FCN32s

Implementation Accuracy Accuracy Class Mean IU FWAVACC Model File
Original 90.4810 76.4824 63.6261 83.4580 fcn32s_from_caffe.npz
Ours (using vgg16_from_caffe.npz) 90.5668 76.8740 63.8180 83.5067 -

FCN16s

Implementation Accuracy Accuracy Class Mean IU FWAVACC Model File
Original 90.9971 78.0710 65.0050 84.2614 fcn16s_from_caffe.npz
Ours (using fcn32s_from_caffe.npz) 90.9671 78.0617 65.0911 84.2604 -
Ours (using fcn32s_voc_iter00092000.npz) 91.1009 77.2522 65.3628 84.3675 -

FCN8s

Implementation Accuracy Accuracy Class Mean IU FWAVACC Model File
Original 91.2212 77.6146 65.5126 84.5445 fcn8s_from_caffe.npz
Ours (using fcn16s_from_caffe.npz) 91.2513 77.1490 65.4789 84.5460 -
Ours (using fcn16s_voc_iter00100000.npz) 91.2608 78.1484 65.8444 84.6447 -

FCN8sAtOnce

Implementation Accuracy Accuracy Class Mean IU FWAVACC Model File
Original 91.1288 78.4979 65.3998 84.4326 fcn8s-atonce_from_caffe.npz
Ours (using vgg16_from_caffe.npz) 91.0883 77.3528 65.3433 84.4276 -

Left to right, FCN32s, FCN16s and FCN8s, which are fully trained using this repo. See above tables to see the accuracy.

License

See LICENSE.

Cite This Project

If you use this project in your research or wish to refer to the baseline results published in the README, please use the following BibTeX entry.

@misc{chainer-fcn2016,
  author =       {Ketaro Wada},
  title =        {{fcn: Chainer Implementation of Fully Convolutional Networks}},
  howpublished = {\url{https://github.com/wkentaro/fcn}},
  year =         {2016}
}
Comments
  • Learnable Deconvolution weights question

    Learnable Deconvolution weights question

    Hello wkentaro,

    One more time, thank you for your awesome contribution. I have a question regarding the upsampling in your implementation. Even though the Deconvolution2D links are initialized with weights, all of them are learnable and don't have the weights fixed, right?

    question 
    opened by dokutagero 9
  • what can I do if I don't use pre-trained model (VGG16) to start training?

    what can I do if I don't use pre-trained model (VGG16) to start training?

    what can I do if I don't use pre-trained model (VGG16) to start training? Annother condition is that if I modify the layer structure in script fcn32s.py that mismatches the structure of pre-trained model(VGG16), such as deleting convolution layer 5, and processes will break down?

    opened by dxiaosa 7
  • Test error

    Test error

    hi, i successfully trained my own datasets with fcn32s model, my data has only two class(background+another one) and i used only 140 images to train my own model, i just want to see the result first. But with the test image, i got the answer: backround ~= 100%, all is background. I don't know why, maybe a small dataset or other something. I have some questions:

    1. How to distinguish the category of your training image area? I mean in segmentclass image, how to recognize the area with red color is a cat not a pig
    2. Because i have just two class, so what is the impact of small data sets on the final outcome? very low accuracy?

    Thank you very much!

    opened by iamGavinZhou 7
  • How to train our own datasets

    How to train our own datasets

    hi, sorry to interrupt you again. I want to train my own datasets(just 2 classes), i think i have changed all the code that needs to be changed, but there are still some problems, can you give an instruction on how to train my own datasets? Thanks train_error

    opened by jinhang 7
  • what is your

    what is your "fcn.data_dir"

    hi, i cloned your repository, but there are some problems, have you tested your code? i used pip to install on my pc, using commond "pip install fcn" followed your instruction, first i should convert caffe model to chainer model, with "./scripts/caffe_to_chainermodel.py ", but i got some wrong message `/usr/local/lib/python2.7/dist-packages/matplotlib/font_manager.py:273: UserWarning: Matplotlib is building the font cache using fc-list. This may take a moment. warnings.warn('Matplotlib is building the font cache using fc-list. This may take a moment.') /usr/local/lib/python2.7/dist-packages/matplotlib/init.py:1350: UserWarning: This call to matplotlib.use() has no effect because the backend has already been chosen; matplotlib.use() must be called before pylab, matplotlib.pyplot, or matplotlib.backends is imported for the first time.

    warnings.warn(_use_error_msg) Traceback (most recent call last): File "./scripts/caffe_to_chainermodel.py", line 64, in main() File "./scripts/caffe_to_chainermodel.py", line 58, in main caffemodel = fcn.setup.download_fcn8s_caffemodel() File "/usr/local/lib/python2.7/dist-packages/fcn/setup.py", line 41, in download_fcn8s_caffemodel url=open(url_file).read().strip(), IOError: [Errno 2] No such file or directory: '/usr/local/lib/python2.7/dist-packages/fcn/_data/fcn.berkeleyvision.org/voc-fcn8s/caffemodel-url' ` it sounds the "fcn.data_dir" is "/usr/local/lib/python2.7/dist-packages/fcn/_data/" but when i use ipython to debug this problem. In first console window, i typed "import fcn; fcn.data_dir", i got the answer "/home/work-station/zx/fcn/data"; But when i opened another console window, i got an answer "/usr/local/lib/python2.7/dist-packages/fcn/_data", it doesn't make sense

    what should i do now, thanks

    opened by iamGavinZhou 7
  • pre-trained fcn32s_model_iter_XXX.h5 seems to be unuseful!

    pre-trained fcn32s_model_iter_XXX.h5 seems to be unuseful!

    When I use the fcn32s_model_iter_XXX.h5 model as the pre-trained model to train fcn16s, the procedure can run, but it decreased the accuracy and make the segmentation worse in the same conditions.

    help wanted 
    opened by dxiaosa 6
  • MeanIU of FCN32 lower than the result in Shelhamer et al. (2016)

    MeanIU of FCN32 lower than the result in Shelhamer et al. (2016)

    I'm training FCN32. The meanIU on validation data set is ~30 % after 100000 iterations. It can't reach the result (63.6 %) of Shelhamer et al. (2016). Is this correct? Would you tell me what is the difference?

    question 
    opened by yasuru 6
  • Doubts with the cropping after deconv

    Doubts with the cropping after deconv

    Hey @wkentaro, I still have a doubt regarding the cropping performed after the transposed convolution. It's more of a conceptual doubt than code itself but maybe some other people might benefit from this doubt.

    In the gist that you provided in the other issue I opened regarding the cropping I understand that after a x32 downsample, when upsampling, depending on the input size there might be an offset (if the size is not divisible by 32) and that's the reason of the cropping. Initially I thought that if I want to train with variable input sizes I have to modify that cropping to match the corresponding offset for that size.

    I tried infering images from my dataset using the infer.py code but I realized that checking the size of the prediction it matches the input size for different sizes, while I was expecting a different size. Shouldn't I modify the offset accordingly and why is the output matching the input size with a fixed crop of 19? I would highly appreciate if you could help me solving this doubt.

    Thanks again!

    question 
    opened by dokutagero 5
  • fcn32.py

    fcn32.py "value error"

    hi,when I try to change pascal.py target_names = np.array([ 'background', 'newtarget', ]) and I reference my VOC2012's segmentation,I prepare some png like this,but can not have the correct result.

    opened by jinhang 5
  • could not train VOC2012 datasets by using fcn_train.py

    could not train VOC2012 datasets by using fcn_train.py

    hi, i installed the VOC2012 datasets in "fcn/data/pascal/VOC2012", and put the "vgg16.chainermodel" on "fcn/data", all i want to do is train the VOC2012 datasets, but it failed, what's the problem? fcn-error

    opened by jinhang 5
  • IOError: [Errno 2] No such file or directory: '/home/gosuncn/anaconda2/lib/python2.7/site-packages/fcn/datasets/../external/fcn.berkeleyvision.org/data/pascal/seg11valid.txt'

    IOError: [Errno 2] No such file or directory: '/home/gosuncn/anaconda2/lib/python2.7/site-packages/fcn/datasets/../external/fcn.berkeleyvision.org/data/pascal/seg11valid.txt'

    i have install the fcn, but i cant found the /external/fcn.berkeleyvision.org/data/pascal/seg11valid.txt' file or directory, i just found '/home/gosuncn/anaconda2/lib/python2.7/site-packages/fcn/datasets/. the directory.
    what should i do? THX

    bug 
    opened by endluo 3
Owner
Kentaro Wada
I'm a final-year PhD student at Imperial College London working on computer vision and robotics.
Kentaro Wada
This repository implements and evaluates convolutional networks on the Möbius strip as toy model instantiations of Coordinate Independent Convolutional Networks.

Orientation independent Möbius CNNs This repository implements and evaluates convolutional networks on the Möbius strip as toy model instantiations of

Maurice Weiler 59 Dec 9, 2022
Another pytorch implementation of FCN (Fully Convolutional Networks)

FCN-pytorch-easiest Trying to be the easiest FCN pytorch implementation and just in a get and use fashion Here I use a handbag semantic segmentation f

Y. Dong 158 Dec 21, 2022
A PyTorch implementation for V-Net: Fully Convolutional Neural Networks for Volumetric Medical Image Segmentation

A PyTorch implementation of V-Net Vnet is a PyTorch implementation of the paper V-Net: Fully Convolutional Neural Networks for Volumetric Medical Imag

Matthew Macy 606 Dec 21, 2022
Another pytorch implementation of FCN (Fully Convolutional Networks)

FCN-pytorch-easiest Trying to be the easiest FCN pytorch implementation and just in a get and use fashion Here I use a handbag semantic segmentation f

Y. Dong 158 Dec 21, 2022
This implements one of result networks from Large-scale evolution of image classifiers

Exotic structured image classifier This implements one of result networks from Large-scale evolution of image classifiers by Esteban Real, et. al. Req

null 54 Nov 25, 2022
Tensorboard for pytorch (and chainer, mxnet, numpy, ...)

tensorboardX Write TensorBoard events with simple function call. The current release (v2.3) is tested on anaconda3, with PyTorch 1.8.1 / torchvision 0

Tzu-Wei Huang 7.5k Dec 28, 2022
Code to reproduce the experiments from our NeurIPS 2021 paper " The Limitations of Large Width in Neural Networks: A Deep Gaussian Process Perspective"

Code To run: python runner.py new --save <SAVE_NAME> --data <PATH_TO_DATA_DIR> --dataset <DATASET> --model <model_name> [options] --n 1000 - train - t

Geoff Pleiss 5 Dec 12, 2022
The code for our paper "NSP-BERT: A Prompt-based Zero-Shot Learner Through an Original Pre-training Task —— Next Sentence Prediction"

The code for our paper "NSP-BERT: A Prompt-based Zero-Shot Learner Through an Original Pre-training Task —— Next Sentence Prediction"

Sun Yi 201 Nov 21, 2022
The official PyTorch implementation of the paper: *Xili Dai, Xiaojun Yuan, Haigang Gong, Yi Ma. "Fully Convolutional Line Parsing." *.

F-Clip — Fully Convolutional Line Parsing This repository contains the official PyTorch implementation of the paper: *Xili Dai, Xiaojun Yuan, Haigang

Xili Dai 115 Dec 28, 2022
A PyTorch implementation of "Cluster-GCN: An Efficient Algorithm for Training Deep and Large Graph Convolutional Networks" (KDD 2019).

ClusterGCN ⠀⠀ A PyTorch implementation of "Cluster-GCN: An Efficient Algorithm for Training Deep and Large Graph Convolutional Networks" (KDD 2019). A

Benedek Rozemberczki 697 Dec 27, 2022
Fang Zhonghao 13 Nov 19, 2022
Reproduce ResNet-v2(Identity Mappings in Deep Residual Networks) with MXNet

Reproduce ResNet-v2 using MXNet Requirements Install MXNet on a machine with CUDA GPU, and it's better also installed with cuDNN v5 Please fix the ran

Wei Wu 531 Dec 4, 2022
A pytorch implementation of Detectron. Both training from scratch and inferring directly from pretrained Detectron weights are available.

Use this instead: https://github.com/facebookresearch/maskrcnn-benchmark A Pytorch Implementation of Detectron Example output of e2e_mask_rcnn-R-101-F

Roy 2.8k Dec 29, 2022
End-to-End Object Detection with Fully Convolutional Network

This project provides an implementation for "End-to-End Object Detection with Fully Convolutional Network" on PyTorch.

null 472 Dec 22, 2022
Dewarping Document Image By Displacement Flow Estimation with Fully Convolutional Network.

Dewarping Document Image By Displacement Flow Estimation with Fully Convolutional Network

null 111 Dec 27, 2022
Dewarping Document Image By Displacement Flow Estimation with Fully Convolutional Network

Dewarping Document Image By Displacement Flow Estimation with Fully Convolutional Network

null 39 Aug 2, 2021
Speech Separation Using an Asynchronous Fully Recurrent Convolutional Neural Network

Speech Separation Using an Asynchronous Fully Recurrent Convolutional Neural Network This repository is the official implementation of Speech Separati

Kai Li (李凯) 116 Nov 9, 2022
Applications using the GTN library and code to reproduce experiments in "Differentiable Weighted Finite-State Transducers"

gtn_applications An applications library using GTN. Current examples include: Offline handwriting recognition Automatic speech recognition Installing

Facebook Research 68 Dec 29, 2022
Code to reproduce the experiments in the paper "Transformer Based Multi-Source Domain Adaptation" (EMNLP 2020)

Transformer Based Multi-Source Domain Adaptation Dustin Wright and Isabelle Augenstein To appear in EMNLP 2020. Read the preprint: https://arxiv.org/a

CopeNLU 36 Dec 5, 2022