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

python kernel dies on caffe.get_solver #4601

Closed
Motherboard opened this issue Aug 16, 2016 · 9 comments
Closed

python kernel dies on caffe.get_solver #4601

Motherboard opened this issue Aug 16, 2016 · 9 comments

Comments

@Motherboard
Copy link

caffe.get_solver(TRAIN.prototxt) dies when passing it the path to this file (extension changed to proto.txt because of github restrictions)

TRAIN.proto.txt
VGG.proto.txt

Jupyter just says the kernel has died and restarts the kernel...

@AnkurAgarwal1989
Copy link

Have you validated your file paths? Is caffe.set_mode_gpu() being used while you are trying to run on cpu? A little more information about the commands will be helpful.

@Motherboard
Copy link
Author

Motherboard commented Aug 17, 2016

made sure path is correct, opened LMDB and viewd images and labels:

lmdb_env = lmdb.open('bmi_transformed_test')
lmdb_txn = lmdb_env.begin()
lmdb_cursor = lmdb_txn.cursor()
datum = caffe.proto.caffe_pb2.Datum()
i = 0
for key, value in lmdb_cursor:
    datum.ParseFromString(value)
    label = datum.label
    data = caffe.io.datum_to_array(datum)
    im = data.astype(np.uint8)
    im = np.transpose(im, (1, 2, 0)) # original (dim, col, row)
    print "label ", label
    plt.imshow(im[:,:,::-1])
    plt.show()
    i += 1
    if i > 5: break

Not using caffe.set_mode_gpu()anywhere, but I've added caffe.set_mode_cpu() just to be sure.

The kernel dies even if I just try to load the network:
net = caffe.Net('VGG.prototxt','VGG_FACE.caffemodel',caffe.TEST)

This works just fine:
net = caffe.Net('VGG_FACE_deploy.prototxt','VGG_FACE.caffemodel',caffe.TEST)

with this file:
VGG_FACE_deploy.proto.txt

But after changing

 input: "data"
 input_dim: 1
 input_dim: 3
 input_dim: 224
 input_dim: 224

to

layer {
  name: "data"
  type: "Data"
  top: "data"
  top: "label"
  include {
    phase: TRAIN
  }
  transform_param {
    mean_value: 129.1863
    mean_value: 104.7624
    mean_value: 93.5940
    mirror: false
  }
  data_param {
    source: "bmi_transformed_train"
    batch_size: 200
    backend: LMDB
  }
}
layer {
  name: "data"
  type: "Data"
  top: "data"
  top: "label"
  include {
    phase: TEST
  }
  transform_param {
    mean_value: 129.1863
    mean_value: 104.7624
    mean_value: 93.5940
    mirror: true
  }
  data_param {
    source: "bmi_transformed_test"
    batch_size: 20
    backend: LMDB
  }
}

and trying to load it again, the python kernel dies...

Also tried it with type: DATA instead of type: "Data", doesn't change anything..

What's the correct way to change the deployed network's data layer to make it suitable for training with an LMDB?
What's wrong with what I'm doing?
And why does it make the kernel die instead of giving any error message?

@AnkurAgarwal1989
Copy link

Can you try running on jupyter console to understand errors better as this link suggests https://groups.google.com/forum/m/#!topic/caffe-users/6iSGJpUhtD8
I am on my cellphone right now. Will try your config once I can access caffe.

@Motherboard
Copy link
Author

Thanks, I ran it from IPython, and I get the following error:

It seems the layer format I'm using is deprecated...

E0818 05:12:45.985389 247 upgrade_proto.cpp:618] Attempting to upgrade input file specified using deprecated V1LayerParameter: VGG_FACE_deploy.prototxt
E0818 05:12:45.985517 247 upgrade_proto.cpp:636] Input NetParameter to be upgraded already specifies 'layer' fields; these will be ignored for the upgrade.
E0818 05:12:45.985699 247 upgrade_proto.cpp:623] Warning: had one or more problems upgrading V1LayerParameter (see above); continuing anyway.
I0818 05:12:45.986189 247 net.cpp:42] Initializing net from parameters:

it then proceeds to writing the net as described in the protobuf, except the data layer, which it threw away, and at the end it writes:

F0818 05:12:45.987861 247 insert_splits.cpp:35] Unknown blob input data to layer 0

Whats the correct new way of writing the data layer?

@AnkurAgarwal1989
Copy link

A quick google search should show you what needs to be changed.
ex:
http://stackoverflow.com/questions/30253520/what-does-attempting-to-upgrade-input-file-specified-using-deprecated-transform

It should be easy to make those changes.

@AnkurAgarwal1989
Copy link

AnkurAgarwal1989 commented Aug 17, 2016

This is no more a valid issue and should be closed. Also, this is not the best place to ask for help. You should ask on the caffe users mailing list. That response is faster and wider.

Cheers,
Ankur

@Motherboard
Copy link
Author

Motherboard commented Aug 18, 2016

@AnkurAgarwal1989
Copy link

AnkurAgarwal1989 commented Aug 18, 2016

Found the commit I wanted to share yesterday. e6c80da

I might have misled you with the previous stackoverflow link. The changes in the commit are the ones that were required by your file. I still do not understand your error though. What version of Caffe are you using?

I changed your file and was able to verify that it is in a correct format with the 'upgrade_net_proto_text' utility.
The exmaple files you mentioned are in the correct format. You can verify that with the utility.

@Motherboard
Copy link
Author

Motherboard commented Aug 19, 2016

Thank you very much!

I was (unknowingly) using a non-official repo from https://github.com/jeffdonahue/caffe.git, branch recurrent-rebase-cleanup

I have since recreated my own docker file with the latest git version from this (BVLC) repo.

Fixed the files, and they seem to get processed fine now, although I've encountered a new error, which seems unrelated to this one - So I'll open a new ticket :)

Thank you again for your time!

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

2 participants