I am able to run iterations of googlenet's training and get some saved states(eg kyle_gn_iter_2000.caffemodel). The problem I have is when I attempt to use the Classifier example (https://github.com/BVLC/caffe/blob/master/examples/cpp_classification/classification.cpp) provided with both the vanilla caffe and his fork, I can't seem to get it to work. What happens is I built it and run it :
ImageClassifier.exe googlenet_test.prototxt kyle_gn_iter_2000.caffemodel mean.binaryproto labels.txt test_image_01.jpg
In the constructor of that class it does the following :
Classifier::Classifier(const string& model_file,
const string& trained_file,
const string& mean_file,
const string& label_file) {
#ifdef CPU_ONLY
Caffe::set_mode(Caffe::CPU);
#else
Caffe::set_mode(Caffe::GPU);
#endif
/* Load the network. */
net_.reset(new Net<float>(model_file, TEST));
net_->CopyTrainedLayersFrom(trained_file);
CHECK_EQ(net_->num_inputs(), 1) << "Network should have exactly one input.";
CHECK_EQ(net_->num_outputs(), 1) << "Network should have exactly one output.";
I get the error and it stops when it determines the net_->num_inputs is zero and net_->num_outputs is two. It is loading my kyle_gn_iter_2000.caffemodel and figuring out the inputs/outputs from there. However, I don't quite follow where it gets those from. I provide test images and training images with jpgs and labels when training. In the end, I do a softmax or accuracy or whatever. I'm not sure how to make it so that I have 1 input and 1 output. How are those determined?
name: "GoogleNet"
layers {
name: "GN"
type: IMAGE_DATA
top: "data"
top: "label"
include {
phase: TRAIN
}
transform_param {
mirror: false
crop_size: 224
mean_file: mean.binaryproto"
scale: 0.00446428571428571428571428571429
}
image_data_param {
source: "cars_training_256.txt"
batch_size: 10
new_height: 224
new_width: 224
}
}
...
...
layers {
bottom: "loss3_classifier_model"
top: "prob"
name: "prob"
type: SOFTMAX
}
The problem seems to have been that I didn't understand that the deploy.prototxt format was different from the one you used for training. I had my image_data layer in the deploy file instead of a simple input declaration.
eg
input: "data"
input_shape {
dim: 10
dim: 3
dim: 224
dim: 224
}
Now I have input of 1 and just need to sort out why it thinks I have two outputs in my network. Thanks!