Skip to content

Instantly share code, notes, and snippets.

@shelhamer
Last active August 10, 2017 10:42
Show Gist options
  • Save shelhamer/91eece041c19ff8968ee to your computer and use it in GitHub Desktop.
Save shelhamer/91eece041c19ff8968ee to your computer and use it in GitHub Desktop.
FCN-8s Fully Convolutional Semantic Segmentation on PASCAL-Context
@scstech
Copy link

scstech commented May 24, 2015

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

@etienne87
Copy link

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

@Linzert
Copy link

Linzert commented Jul 10, 2015

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

@QingSunVT
Copy link

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

@aabobakr
Copy link

@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.

Copy link

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.

Copy link

ghost commented Nov 5, 2015

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

Copy link

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
Copy link

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

@ch977
Copy link

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
Copy link

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
Copy link

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

@xjtuljy
Copy link

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?

@arasharchor
Copy link

@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