Caffe running imagenet with images that are 32X32

2,901 views
Skip to first unread message

Andriy Lysak

unread,
Nov 14, 2014, 1:15:40 PM11/14/14
to caffe...@googlegroups.com
So my problem consists of not being able to train the imagenet with smaller images (32X32) when i resize them to 256X256 everything starts training fine. So I know that the issue are my settings.

i tried to set my own settings for:

deploy.prototxt: i set the last 2 input_dims to 32

solver.prototxt: i set solver_mode: CPU (left everything else alone)

train_val.prototxt: i set crop_size: 31 for both of the settings

all the paths are correct as the training runs fine with images resized to 256X256

but with the setup i described above i get this error:

 I1114 11:53:38.484948  4566 net.cpp:96] Setting up fc6
F1114 11:53:38.484967  4566 blob.cpp:72] Check failed: data_
*** Check failure stack trace: ***
    @     0x7f82ed8a0daa  (unknown)
    @     0x7f82ed8a0ce4  (unknown)
    @     0x7f82ed8a06e6  (unknown)
    @     0x7f82ed8a3687  (unknown)
    @           0x45814e  caffe::Blob<>::mutable_cpu_data()
    @           0x4c12fa  caffe::GaussianFiller<>::Fill()
    @           0x4e5719  caffe::InnerProductLayer<>::LayerSetUp()
    @           0x4705e1  caffe::Net<>::Init()
    @           0x471eee  caffe::Net<>::Net()
    @           0x452560  caffe::Solver<>::InitTrainNet()
    @           0x4537c6  caffe::Solver<>::Init()
    @           0x453926  caffe::Solver<>::Solver()
    @           0x415650  caffe::GetSolver<>()
    @           0x411b44  train()
    @           0x40ef21  main
    @     0x7f82ea913ec5  (unknown)
    @           0x410697  (unknown)
    @              (nil)  (unknown)
train_caffenet_letter.sh: line 4:  4566 Aborted                 (core dumped) ./build/tools/caffe train --solver=models/bvlc_reference_caffenet/solver_letter.prototxt

If anyone could please explain what other settings i should change in these files, or am i doing it completely wrong?

Bartosz Ludwiczuk

unread,
Nov 15, 2014, 10:27:13 AM11/15/14
to caffe...@googlegroups.com
Hi, could you show you net.proto file? 

As I understand, you want to run ImageNet network, which input is 256x256 at 32x32 images.
It is impossible to do it in such way. 
To do this, you have to:
- change input size (you do this)
- remove all fully connected layers and replace them by yours layers (see fine-tune example, which will show you exactly how to do that)
- learn this new layers using 32x32 images
- use them to classify images

or learn all net from begginig.

Why you try does not work? Because of dimension issue. Fully connected layer always need same features vector at input. As you downsize image to 32x32, features vector has lower dimension. So you need replace FC layer that they match your image dimensions==features vector at conv5.


Andriy Lysak

unread,
Nov 15, 2014, 5:03:01 PM11/15/14
to caffe...@googlegroups.com
Bartosz,

That's great advice. Yes I want to train my own ImageNet. I dont want to use the pre-trained one that comes with the examples.

So what I want to do is: "
learn all net from beginning"

Im not sure what you mean by net.proto :(

I followed the online example and I have 3 files: deploy_letter.prototxt; solver_letter.prototxt; train_val_letter.prototxt

now what im not sure about is the: settings in those files.

My question is how do i modify them so that i can train my own ImageNet on my own 32X32 images that belong to 27 classes?

I greatly appreciate that you took the time to respond to my question!!!

If there is anything else that you would need me to upload just let me know:)
deploy_letter.prototxt
solver_letter.prototxt
train_val_letter.prototxt

Bartosz Ludwiczuk

unread,
Nov 16, 2014, 3:53:52 AM11/16/14
to caffe...@googlegroups.com
Thank for file, that was what I exactly had in mind. As I see this files, they look ok. 

I made small test: I run your network definition on CIFAR-10 (32x32) database from examples. And it works, so no error in initializing (fc6 was created).
You can make similar test (just replace paths of databases). If that will success, you can compare initialize process. 
I must say, that I do not know why this does not work.

 

Andriy Lysak

unread,
Nov 16, 2014, 10:33:58 AM11/16/14
to caffe...@googlegroups.com
Bartosz,

Thanx for trying it out! I really appreciate it! I reinstalled Ubuntu and everything else and the file ran just fine. Not sure what the issue might have been. Maybe some dependency wan't built properly?

Anyway I'm glad it got resolved.

Im really new to Neural Networks can you tell me where i can find what all the settings mean in Caffe .proto files. is there a tutorial or something similar for them?

Thank You!!!

Best Regards,
Andriy

Bartosz Ludwiczuk

unread,
Nov 17, 2014, 3:26:26 AM11/17/14
to caffe...@googlegroups.com
I am glad that everything works.
About knowing all parameters: you need to read some tutorial about Deep Learning. (ex. https://sites.google.com/site/deeplearningcvpr2014/). There are plenty of them, so you will find some.
Then, you can go through tutorial about Caffe: http://caffe.berkeleyvision.org/tutorial/ 

This should help you at begging of Deep Learning framework.

Andriy Lysak

unread,
Nov 17, 2014, 11:51:03 AM11/17/14
to caffe...@googlegroups.com
Bartosz,

Great! Thank you for your advice! I will definitely go through the tutorials:)

Best Regards,
Andriy

Zhihong Zeng

unread,
Dec 19, 2014, 10:34:49 AM12/19/14
to caffe...@googlegroups.com
Hello,

I am wondering why in Andriy's train_val.prototxt and deploy_letter.prototxt, the input_dim and crop_size are set to 31 instead of 32.

Thanks

Andriy Lysak

unread,
Jan 28, 2015, 5:41:13 PM1/28/15
to caffe...@googlegroups.com
Hi, I'm sorry it took this long to respond.

Basically what happened is that I decided to crop them a little as a test. The original model also crops the images and makes them 227X227

Im not sure what would happen if you dont crop the images (I never tried to experiment with it. Just had not time).

Best Regards,
Andriy

文小森

unread,
Jul 9, 2015, 9:34:43 AM7/9/15
to caffe...@googlegroups.com
Hello,
I also want to use my data,is 48*48,rather than resize to 256*256,could you tell me how  to modify in alexnet or caffenet?
Thanks!

在 2014年11月18日星期二 UTC+8上午12:51:03,Andriy Lysak写道:

文小森

unread,
Jul 9, 2015, 9:49:28 AM7/9/15
to caffe...@googlegroups.com
Hello,
I also want to use my data,is 48*48,rather than resize to 256*256,could you tell me how  to modify in alexnet or caffenet?
Thanks!

在 2014年11月16日星期日 UTC+8下午4:53:52,Bartosz Ludwiczuk写道:
Reply all
Reply to author
Forward
0 new messages