ry / tensorflow-vgg16

conversation of caffe vgg16 model to tensorflow
672 stars 285 forks source link

How to get the activations of layers below prob? #2

Open jazzsaxmafia opened 8 years ago

jazzsaxmafia commented 8 years ago

Hello, thank you for this great source code.

I would like to use the FC layers below prob layer, but I am not sure how I should do it. I tried something like "graph.get_tensor_by_name("import/fc7:0") but it does not work.

Thank you -Taeksoo

jazzsaxmafia commented 8 years ago

Just found out that the names of FC tensors were not set in "caffe_to_tensorflow.py". I guess it was the reason why.

By the way, when I run "caffe_to_tensorflow.py", by "make", it runs into an error like below.

current context was not created by the StreamExecutor cuda_driver API: 0x3c6ab90; a CUDA runtime call was likely performed without using a StreamExecutor context make: *\ [vgg16.tfmodel] Aborted (core dumped)

Could you please help me getting through this?

Thank you.

-Taeksoo

seppemans commented 8 years ago

I ran into the same issue.

The notes of caffe-tensorflow, a similar project, mention that

It appears that Caffe and TensorFlow cannot be concurrently invoked (CUDA conflicts - even with set_mode_cpu). This makes it a two-stage process: first extract the parameters with convert.py, then import it into TensorFlow.

The conversion ran successfully after installing the CPU-only version of Tensorflow. Not great, but it works.

hamidpalangi commented 8 years ago

Great work @ry, very useful! @jazzsaxmafia : Try listing all Tensor names by:

    ops = sess.graph.get_operations()
    for i in xrange(len(ops)):
        print(ops[i].values())

then pick up the layer you want.

Yelrose commented 8 years ago

@Palang2014 Thanks a lot! Your code do great helps! And Great work @ry