void AVInputOp::CheckParamsAndPrint()

in ops/av_input_op.h [131:277]


void AVInputOp<Context>::CheckParamsAndPrint() {

  // check whether the input parameters are valid or not
  CAFFE_ENFORCE_GT(batch_size_, 0, "Batch size should be positive.");
  if (get_rgb_) {
    CAFFE_ENFORCE_GT(
        clip_per_video_, 0, "Number of clips per video should be positive.");
    CAFFE_ENFORCE_GT(crop_size_, 0, "Must provide the cropping value.");
    CAFFE_ENFORCE_GT(
        num_of_required_frame_, 0, "Required number of frames must be positive."
    );

    if (video_res_type_ == VideoResType::USE_SHORT_EDGE) {
      CAFFE_ENFORCE_GT(short_edge_, 0, "Must provide the short edge value.");
      CAFFE_ENFORCE_GE(
          short_edge_,
          crop_size_,
          "The short edge must be no smaller than the crop value.");
    } else if (video_res_type_ == VideoResType::USE_WIDTH_HEIGHT) {
      CAFFE_ENFORCE_GT(scale_h_, 0, "Must provide the scale height value.");
      CAFFE_ENFORCE_GT(scale_w_, 0, "Must provide the scale width value.");
      CAFFE_ENFORCE_GE(
          scale_h_,
          crop_size_,
          "The scaled height must be no smaller than the crop value.");
      CAFFE_ENFORCE_GE(
          scale_w_,
          crop_size_,
          "The scaled width must be no smaller than the crop value.");
    }
  }

  if (jitter_scales_.size() > 0) {
    CAFFE_ENFORCE_GE(
      video_res_type_,
      VideoResType::USE_SHORT_EDGE,
      "Scale jittering is used with short_edge scaling only"
    );
  }

  if (get_rgb_) {
    CAFFE_ENFORCE_GT(length_rgb_, 0, "Must provide rgb clip length.");
    CAFFE_ENFORCE_GT(
        sampling_rate_rgb_, 0, "4 frames for mc2; 2 frames for res3d.");
    CAFFE_ENFORCE_EQ(
        channels_rgb_, mean_rgb_.size(), "Number rgb channels is wrong!");
    CAFFE_ENFORCE_EQ(
        channels_rgb_, inv_std_rgb_.size(), "Number rgb channels is wrong!");
  }

  if (clip_per_video_ > 1) {
    CAFFE_ENFORCE_EQ(
        decode_type_,
        DecodeType::DO_UNIFORM_SMP,
        "Only uniformly sampling is supported when sampling multiple clips!");
  }

  if (do_multi_label_) {
    CAFFE_ENFORCE_GT(
        num_of_class_,
        0,
        "Number of classes must be set when using multiple labels.");
  }

  if (get_logmels_) {
    CAFFE_ENFORCE_GT(
        logMelFrames_,
        0,
        "Number of log mel frames must be set when using log mel feature.");
    CAFFE_ENFORCE_GT(
        logMelFilters_,
        0,
        "Number of log mel filters must be set when using log mel feature.");
    CAFFE_ENFORCE_GT(
        logMelWindowSizeMs_,
        0,
        "Audio Window size must be set when using log mel feature.");
    CAFFE_ENFORCE_GT(
        logMelWindowStepMs_,
        0,
        "Audio Window step must be set when using log mel feature.");
    CAFFE_ENFORCE_GT(
        logMelAudioSamplingRate_,
        0,
        "Audio sampling rate must be set when using log mel feature.");
  }

  // print out the parameter settings
  LOG(INFO) << "Creating a clip input op with the following setting: ";
  LOG(INFO) << "    Using " << num_decode_threads_ << " CPU threads;";
  LOG(INFO) << "    Outputting in batches of " << batch_size_ << " videos;";
  LOG(INFO) << "    Each video has " << clip_per_video_ << " clips;";
  LOG(INFO) << "    Scaling image to " << scale_h_ << "x" << scale_w_;
  LOG(INFO) << "    Cropping video frame to " << crop_size_
            << (random_mirror_ ? " with " : " without ") << "random mirroring;";
  LOG(INFO) << "    Using " << (random_crop_ ? "random" : "center") << " crop";

  if (get_rgb_) {
    LOG(INFO) << "    Using a clip of " << length_rgb_ << " rgb frames "
              << "with " << channels_rgb_ << " channels "
              << "and a sampling rate of 1:" << sampling_rate_rgb_;
    for (int i = 0; i < channels_rgb_; i++) {
      LOG(INFO) << "    RGB " << i << "-th channel mean: " << mean_rgb_[i]
                << " std: " << 1.f / inv_std_rgb_[i];
    }
  }

  if (get_logmels_) {
    LOG(INFO) << "    Using log mels with"
              << logMelFilters_ << " filters "
              << logMelFrames_ << " frames "
              << logMelWindowSizeMs_ << " window size (ms) "
              << logMelWindowStepMs_ << " window step (ms) "
              << logMelAudioSamplingRate_ << " audio sampling rate ";
  }

  if (video_res_type_ == VideoResType::ORIGINAL_RES) {
    LOG(INFO) << "    Use original resolution";
  } else if (video_res_type_ == VideoResType::USE_SHORT_EDGE) {
    LOG(INFO) << "    Resize and keep aspect ratio";
  } else if (video_res_type_ == VideoResType::USE_WIDTH_HEIGHT) {
    LOG(INFO) << "    Resize and ignore aspect ratio";
  } else {
    LOG(ERROR) << "    Unknown video resolution type";
  }

  if (video_res_type_ == VideoResType::USE_SHORT_EDGE) {
    if (jitter_scales_.size() > 0) {
      LOG(INFO) << "Using scale jittering:";
      for (int idx = 0; idx < jitter_scales_.size(); idx++) {
        LOG(INFO) << "scale " << idx <<": "<< jitter_scales_[idx];
      }
    } else {
      LOG(INFO) << "No scale jittering is used.";
    }
  }

  if (decode_type_ == DecodeType::DO_TMP_JITTER) {
    LOG(INFO) << "    Do temporal jittering";
  } else if (decode_type_ == DecodeType::USE_START_FRM) {
    LOG(INFO) << "    Use start_frm for decoding";
  } else if (decode_type_ == DecodeType::DO_UNIFORM_SMP) {
    LOG(INFO) << "    Do uniformly sampling";
  } else {
    LOG(ERROR) << "    Unknown video decoding type";
  }
}