CHECK(data.size()) << "Image cropping only support uint8 data";
int h_off, w_off;
// We only do random crop when we do training.
- if (Caffe::phase() == Caffe::TRAIN) {
+ if (layer->phase_ == Caffe::TRAIN) {
// NOLINT_NEXT_LINE(runtime/threadsafe_fn)
h_off = rand() % (height - crop_size);
// NOLINT_NEXT_LINE(runtime/threadsafe_fn)
prefetch_label_->mutable_cpu_data();
data_mean_.cpu_data();
DLOG(INFO) << "Initializing prefetch";
+ phase_ = Caffe::phase();
CHECK(!pthread_create(&thread_, NULL, ImageDataLayerPrefetch<Dtype>,
reinterpret_cast<void*>(this))) << "Pthread execution failed.";
DLOG(INFO) << "Prefetch initialized.";
memcpy((*top)[1]->mutable_cpu_data(), prefetch_label_->cpu_data(),
sizeof(Dtype) * prefetch_label_->count());
// Start a new prefetch thread
+ phase_ = Caffe::phase();
CHECK(!pthread_create(&thread_, NULL, ImageDataLayerPrefetch<Dtype>,
reinterpret_cast<void*>(this))) << "Pthread execution failed.";
return Dtype(0.);
prefetch_label_->cpu_data(), sizeof(Dtype) * prefetch_label_->count(),
cudaMemcpyHostToDevice));
// Start a new prefetch thread
+ phase_ = Caffe::phase();
CHECK(!pthread_create(&thread_, NULL, ImageDataLayerPrefetch<Dtype>,
reinterpret_cast<void*>(this))) << "Pthread execution failed.";
return Dtype(0.);