MCPcopy Create free account
hub / github.com/OpenPTrack/open_ptrack_v2 / InferBlobShape

Method InferBlobShape

rtpose_wrapper/src/caffe/data_transformer.cpp:457–490  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

455
456template<typename Dtype>
457vector<int> DataTransformer<Dtype>::InferBlobShape(const Datum& datum) {
458 if (datum.encoded()) {
459#ifdef USE_OPENCV
460 CHECK(!(param_.force_color() && param_.force_gray()))
461 << "cannot set both force_color and force_gray";
462 cv::Mat cv_img;
463 if (param_.force_color() || param_.force_gray()) {
464 // If force_color then decode in color otherwise decode in gray.
465 cv_img = DecodeDatumToCVMat(datum, param_.force_color());
466 } else {
467 cv_img = DecodeDatumToCVMatNative(datum);
468 }
469 // InferBlobShape using the cv::image.
470 return InferBlobShape(cv_img);
471#else
472 LOG(FATAL) << "Encoded datum requires OpenCV; compile with USE_OPENCV.";
473#endif // USE_OPENCV
474 }
475 const int crop_size = param_.crop_size();
476 const int datum_channels = datum.channels();
477 const int datum_height = datum.height();
478 const int datum_width = datum.width();
479 // Check dimensions.
480 CHECK_GT(datum_channels, 0);
481 CHECK_GE(datum_height, crop_size);
482 CHECK_GE(datum_width, crop_size);
483 // Build BlobShape.
484 vector<int> shape(4);
485 shape[0] = 1;
486 shape[1] = datum_channels;
487 shape[2] = (crop_size)? crop_size: datum_height;
488 shape[3] = (crop_size)? crop_size: datum_width;
489 return shape;
490}
491
492template<typename Dtype>
493vector<int> DataTransformer<Dtype>::InferBlobShape(

Callers 4

DataLayerSetUpMethod · 0.80
load_batchMethod · 0.80
DataLayerSetUpMethod · 0.80
load_batchMethod · 0.80

Calls 6

DecodeDatumToCVMatFunction · 0.85
DecodeDatumToCVMatNativeFunction · 0.85
channelsMethod · 0.45
heightMethod · 0.45
widthMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected