Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to specify the validation files during training #33

Open
yiyao35 opened this issue Apr 15, 2016 · 5 comments
Open

How to specify the validation files during training #33

yiyao35 opened this issue Apr 15, 2016 · 5 comments

Comments

@yiyao35
Copy link

yiyao35 commented Apr 15, 2016

Hi @alexgkendall
How can I specify the validation file (val.txt) for validation for the segnet training ? I have found no input as specifying the train.txt file path in Segnet-tutorial-master/Models/segnet_basic_solver.prototxt.
And what's the parameter "test_initialization" mean in the solver.prototxt ?
Thanks a lot.

@aralph
Copy link

aralph commented Apr 21, 2016

Hi yiyao35,

As you noticed correctly, the solver.prototxt does not directly link to a list of images (e.g. train.txt or val.txt).
Instead, it points to a chosen net model file. This model file can contain different nets for training and validation, see section Model Definition of the ImageNet tutorial for explanations on how to do that. These different nets then point to the the list of images (train.txt and val.txt) so that the specific images are used for training and validation.
You can easily extend the tutorial files to do this. Your segnet_basic_train.prototxt could look as follows:

layer {
  name: "data"
  type: "DenseImageData"
  ...
  dense_image_data_param {
    source: "/.../train.txt"
  ...
  }
  include {
    phase: TRAIN
  }
}
layer {
  name: "data"
  type: "DenseImageData"
  ...
  dense_image_data_param {
    source: "/.../val.txt"
  ...
  }
  include {
    phase: TEST
  }
}
...

To clarify your question concerning the test_initialization parameter, you can add the following comment to your solver.prototxt:

# If true, run an initial test pass before the first iteration,
# ensuring memory availability and printing the starting value of the loss. 
# True by default.
test_initialization: false

If you have usage questions on caffe like these here, please ask on caffe-users since git issues should focus on bugs and development discussion.

@yiyao35
Copy link
Author

yiyao35 commented Apr 28, 2016

understood~ thanks a lot!

@codecolony
Copy link

HI @aralph,

I don't see this linking of val.txt for segnet anywhere. I trained my dataset with only two folder "train" and "test" as that's what seems to be linked. Can you please tell me if not using "val" folder in segnet can affect my results? I'm currently having problems seeing correct results although the training says the process has converged. Can you please help me?

@aralph
Copy link

aralph commented Jun 2, 2016

Hi @codecolony,

The segnet tutorial does not use a validation dataset. As I mentioned, you need to extend the tutorial code in order to make use of validation data:

You can easily extend the tutorial files to do this. Your segnet_basic_train.prototxt could look as follows:

By calculating the accuracy on a validation dataset during training, you get an indication of how well your net generalises to unseen data. However, the training itself, i.e. the learning of parameters, is not influenced by this.

@ravibhandari2006
Copy link

How can i print the image names, for which the prediction is being done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants