RGB works, grayscale fails

601 views
Skip to first unread message

Steven Clark

unread,
Jan 27, 2015, 5:15:47 PM1/27/15
to caffe...@googlegroups.com
I modified the ImageNet reference net to discriminate between two classes of images. When I use color images, test accuracy is 94%. But when I try to convert the images & network to grayscale, it doesn't converge (accuracy ~30%).

Here's how I tried to convert the net to grayscale, maybe I am missing a step:

1) Convert all images to grayscale using PIL.
2) Re-run create_imagenet.sh, passing --gray into convert_imageset
3) Re-run make_image_mean.sh
4) attempt to train. I see "Top shape: 50 1 227 227" as expected (vs. "Top shape: 50 3 227 227" with RGB). But accuracy never improves.

What am I forgetting? Do any changes need to be made to train_val.prototxt?

Yushu Gao

unread,
Jan 28, 2015, 9:01:41 AM1/28/15
to Steven Clark, caffe...@googlegroups.com
the master branch and dev branch have some bugs that grayscale image cant converge, if you use tag v0.9999 I think it will converge. I have report this bug, but I have not fixed yet. hoping this can help you.

Best regards
Yushu Gao

--
You received this message because you are subscribed to the Google Groups "Caffe Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to caffe-users...@googlegroups.com.
To post to this group, send email to caffe...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/caffe-users/739f5066-6445-4d65-acb5-69bee898b5fd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Steven Clark

unread,
Jan 28, 2015, 2:48:26 PM1/28/15
to caffe...@googlegroups.com, steven....@gmail.com
Thanks Yushu, it is good to know that I'm not going crazy.
I will try the tag # you mention when I get a chance.
Have any of the caffe developers confirmed this bug?

Steven Clark

unread,
Feb 10, 2015, 8:41:53 PM2/10/15
to caffe...@googlegroups.com, steven....@gmail.com
Just wanted to follow up that I grabbed the latest dev branch today, and using googlenet model as a reference, was able to get grayscale working no problem. Not sure what's different now, but I'm happy.

James Guo

unread,
Feb 11, 2015, 3:31:38 AM2/11/15
to caffe...@googlegroups.com, steven....@gmail.com
Try write the Python script and network configuration by yourself, you would find it's really helpful to understand Caffe's usage. Their basic implementation is good, I've used them all along. Maybe there is some bug in the examples.
Reply all
Reply to author
Forward
0 new messages