if (this->output_labels_) {
top_label = this->prefetch_label_.mutable_cpu_data();
}
- const int batch_size = this->layer_param_.data_param().batch_size();
+ bool force_color = this->layer_param_.data_param().force_encoded_color();
for (int item_id = 0; item_id < batch_size; ++item_id) {
timer.Start();
// get a blob
cv::Mat cv_img;
if (datum.encoded()) {
- cv_img = DecodeDatumToCVMatNative(datum);
- if (force_color)
++ if (force_color) {
+ cv_img = DecodeDatumToCVMat(datum, true);
- else
++ } else {
+ cv_img = DecodeDatumToCVMatNative(datum);
- if (cv_img.channels() != this->transformed_data_.channels())
++ }
++ if (cv_img.channels() != this->transformed_data_.channels()) {
+ LOG(WARNING) << "Your dataset contains encoded images with mixed "
+ << "channel sizes. Consider adding a 'force_color' flag to the "
+ << "model definition, or rebuild your dataset using "
+ << "convert_imageset.";
++ }
}
read_time += timer.MicroSeconds();
timer.Start();