Possible to fine-tune RGB to grayscale?

745 views
Skip to first unread message

Steven Clark

unread,
Mar 17, 2015, 5:21:37 PM3/17/15
to caffe...@googlegroups.com
Is it possible to fine-tune, say, the googlenet model to use grayscale input rather than RGB? Or would the weights be so different as to make the question non-sensical?

Steven Clark

unread,
Mar 17, 2015, 5:45:47 PM3/17/15
to caffe...@googlegroups.com
The naive approach gave this error:

$CAFFE_ROOT/build/tools/caffe train -solver quick_solver.prototxt -weights bvlc_googlenet.caffemodel -gpu 0

--->

F0317 17:44:12.840243 19413 net.cpp:711] Check failed: target_blobs[j]->channels() == source_layer.blobs(j).channels() (1 vs. 3)

cat...@stanford.edu

unread,
Apr 10, 2015, 1:43:42 AM4/10/15
to caffe...@googlegroups.com
Did you figure anything this out for this? One thing that worked for me was to just pretend images were color jpgs and basically have the respective intensities in each channel. However, when I actually store them as grayscales I get the same error.

Umut Güçlü

unread,
Apr 12, 2015, 6:54:11 PM4/12/15
to caffe...@googlegroups.com
If you do not want to perform any net surgery, you have to use a three channel input. You can either (i) repeat copies of your grayscale images or (ii) pad them with zeros. For example, you can do the following in MATLAB:

(i) X = repmat(X, [1 1 3]);
(ii) X = padarray(X, [0 0 2], 'post');

where X is a grayscale image. See Section 3.4. in http://arxiv.org/abs/1503.08909 for an example of finetuning a three channel model on two channel inputs. tl;dr they use (ii).
Reply all
Reply to author
Forward
0 new messages