Create a gist now

Instantly share code, notes, and snippets.

@shelhamer /readme.md Secret
Last active Aug 10, 2017

Embed
What would you like to do?
FCN-8s Fully Convolutional Semantic Segmentation on PASCAL-Context
@scstech

This comment has been minimized.

Show comment
Hide comment
@scstech

scstech May 24, 2015

How I can put the data? How I can undesrtand the labels?

scstech commented May 24, 2015

How I can put the data? How I can undesrtand the labels?

@etienne87

This comment has been minimized.

Show comment
Hide comment
@etienne87

etienne87 Jun 5, 2015

same question here? an example for fully-convolutional forward & backward with ground truth segmentation would be great ?

same question here? an example for fully-convolutional forward & backward with ground truth segmentation would be great ?

@Linzert

This comment has been minimized.

Show comment
Hide comment
@Linzert

Linzert Jul 10, 2015

@shelhamer What's your input format?How can I train your model using my own datas?

Linzert commented Jul 10, 2015

@shelhamer What's your input format?How can I train your model using my own datas?

@QingSunVT

This comment has been minimized.

Show comment
Hide comment
@QingSunVT

QingSunVT Sep 25, 2015

Are Database pascal-context-train-lmdb and pascal-context-test-lmdb available online?

Are Database pascal-context-train-lmdb and pascal-context-test-lmdb available online?

@aabobakr

This comment has been minimized.

Show comment
Hide comment
@aabobakr

aabobakr Oct 22, 2015

@shelhamer I have run the 32 stride version and it works. But, when trying to run the 8 stride version I get this error when loading the model
net = caffe.Net('/fcn-8/deploy.prototxt', '/fcn-8/fcn-8s-pascal.caffemodel', caffe.TEST)

ERROR: Cannot copy param 0 weights from layer 'score-pool4'; shape mismatch. Source param shape is 21 512 1 1 (10752); target param shape is 60 512 1 1 (30720). To learn this layer's parameters from scratch rather than copying from a saved net, rename the layer.

@shelhamer I have run the 32 stride version and it works. But, when trying to run the 8 stride version I get this error when loading the model
net = caffe.Net('/fcn-8/deploy.prototxt', '/fcn-8/fcn-8s-pascal.caffemodel', caffe.TEST)

ERROR: Cannot copy param 0 weights from layer 'score-pool4'; shape mismatch. Source param shape is 21 512 1 1 (10752); target param shape is 60 512 1 1 (30720). To learn this layer's parameters from scratch rather than copying from a saved net, rename the layer.

@ghost

This comment has been minimized.

Show comment
Hide comment
@ghost

ghost Nov 5, 2015

@aabobakr I think that .caffemodel is trained using 21-class PASCAL VOC instead of 60-class PASCAL CONTEXT but the .prototxt is used for the PASCAL CONTEXT, which causes the incompatibility.

ghost commented Nov 5, 2015

@aabobakr I think that .caffemodel is trained using 21-class PASCAL VOC instead of 60-class PASCAL CONTEXT but the .prototxt is used for the PASCAL CONTEXT, which causes the incompatibility.

@ghost

This comment has been minimized.

Show comment
Hide comment

ghost commented Nov 5, 2015

@scstech @etienne87 @Linzert You may refer to FCN-32s.

@ghost

This comment has been minimized.

Show comment
Hide comment
@ghost

ghost Nov 5, 2015

@aabobakr Hi, I have tried to run the FCN-32s model by running eval.py and I have come across a problem here. Could you help me with it? Thanks!

ghost commented Nov 5, 2015

@aabobakr Hi, I have tried to run the FCN-32s model by running eval.py and I have come across a problem here. Could you help me with it? Thanks!

@abidrahmank

This comment has been minimized.

Show comment
Hide comment
@abidrahmank

abidrahmank Dec 23, 2015

First convolution layer padding is given as 100. Can anyone explain the reason for high padding values?

First convolution layer padding is given as 100. Can anyone explain the reason for high padding values?

@ch977

This comment has been minimized.

Show comment
Hide comment
@ch977

ch977 Jan 15, 2016

@abidrahmank
later layers do some crop, I think it is the reason why the pad be 100 in the first layer.
For example, pool5 layer is (512,22,22),and fc6 layer is (4096,16,16). So pool5 layer has been cropped.
If you don't use 100 pad , you won't get last layer.

ch977 commented Jan 15, 2016

@abidrahmank
later layers do some crop, I think it is the reason why the pad be 100 in the first layer.
For example, pool5 layer is (512,22,22),and fc6 layer is (4096,16,16). So pool5 layer has been cropped.
If you don't use 100 pad , you won't get last layer.

@xavierpuigf

This comment has been minimized.

Show comment
Hide comment
@xavierpuigf

xavierpuigf Jan 22, 2016

Hi, I am trying to train fcn-8 on pascal-context dataset to replicate results but so far my loss doesn't seem to be decreasing. I have also tried finetuning from fcn-8-pascalcontext model, but my loss at iteration 0 is 1.7788e+06.

Considering that iteration 0 is just an evaluation of the model, shouldn't I get a much lower loss? Note that here I am not doing the net surgery step.

Hi, I am trying to train fcn-8 on pascal-context dataset to replicate results but so far my loss doesn't seem to be decreasing. I have also tried finetuning from fcn-8-pascalcontext model, but my loss at iteration 0 is 1.7788e+06.

Considering that iteration 0 is just an evaluation of the model, shouldn't I get a much lower loss? Note that here I am not doing the net surgery step.

@abidrahmank

This comment has been minimized.

Show comment
Hide comment
@abidrahmank

abidrahmank Jan 27, 2016

What is the functionality of crop Layer and Eltwise Fusion in this network?

What is the functionality of crop Layer and Eltwise Fusion in this network?

@xjtuljy

This comment has been minimized.

Show comment
Hide comment
@xjtuljy

xjtuljy Feb 4, 2016

Hi all, I now try to export the prediction from the FCN using C++ for my project. But I end up with some very strange images.

In my problem I tried to build my own fcn and there are only two classes to segment (0 and 1)

Here is my code to read the output of the forward pass:
////////////////////////////////////////////////////////////////
const vector<Blob>& result = caffe_net.Forward(bottom_vec, &iter_loss); // forward pass
const float
result_vec = result[0]->cpu_data();

// generate prediction from the output vector and store it in Mat
cv::Mat srcC = cv::Mat::zeros(cv::Size(512,384), CV_32FC1);
int nl= srcC.rows;
int nc= srcC.cols;

for (int j=0; j<nl; j++) {
float* data= srcC.ptr(j);
for (int i=0; i<nc; i++) {
if (result_vec[i+j*nc+datum.height()*datum.width()] > result_vec[i+j_nc]);
// compare the value from different classes and generate the prediction
data[i] = 255;
}
}
//////////////////////////////////////////////////////////////////
The output of CNN is in format of const float_, but I don't know whether the data is arranged in c_h_w or w_h_c order for fcn, and due to the wired output Mat I got, I think maybe I did it in the wrong way. Can somebody help with this please?

xjtuljy commented Feb 4, 2016

Hi all, I now try to export the prediction from the FCN using C++ for my project. But I end up with some very strange images.

In my problem I tried to build my own fcn and there are only two classes to segment (0 and 1)

Here is my code to read the output of the forward pass:
////////////////////////////////////////////////////////////////
const vector<Blob>& result = caffe_net.Forward(bottom_vec, &iter_loss); // forward pass
const float
result_vec = result[0]->cpu_data();

// generate prediction from the output vector and store it in Mat
cv::Mat srcC = cv::Mat::zeros(cv::Size(512,384), CV_32FC1);
int nl= srcC.rows;
int nc= srcC.cols;

for (int j=0; j<nl; j++) {
float* data= srcC.ptr(j);
for (int i=0; i<nc; i++) {
if (result_vec[i+j*nc+datum.height()*datum.width()] > result_vec[i+j_nc]);
// compare the value from different classes and generate the prediction
data[i] = 255;
}
}
//////////////////////////////////////////////////////////////////
The output of CNN is in format of const float_, but I don't know whether the data is arranged in c_h_w or w_h_c order for fcn, and due to the wired output Mat I got, I think maybe I did it in the wrong way. Can somebody help with this please?

@smajida

This comment has been minimized.

Show comment
Hide comment
@smajida

smajida Mar 11, 2016

@shelhamer I want to fine tune fcn8 on a different dataset for predicting flow magnitude map which is gray scale image by doing regression by changing the loss to euclidean and num_outputs of last layer to 1. is that right?
The loss is too high. basically for how many iterations should I set it in this case?
should I first do some changes in solver around your parameters or in this case I should decrease e.g. base_lr because now we are finetuning.

thanks a lot for your help

smajida commented Mar 11, 2016

@shelhamer I want to fine tune fcn8 on a different dataset for predicting flow magnitude map which is gray scale image by doing regression by changing the loss to euclidean and num_outputs of last layer to 1. is that right?
The loss is too high. basically for how many iterations should I set it in this case?
should I first do some changes in solver around your parameters or in this case I should decrease e.g. base_lr because now we are finetuning.

thanks a lot for your help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment