Skip to content

Commit

Permalink
for quantized models
Browse files Browse the repository at this point in the history
  • Loading branch information
freedomtan committed Nov 28, 2023
1 parent 67b70e2 commit d08ee17
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion flutter/cpp/datasets/imagenet.cc
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,12 @@ Imagenet::Imagenet(Backend *backend, const std::string &image_dir,
"image_preprocessing", DataType2TfType(input_format_.at(0).type));
builder.AddCroppingStep(kCroppingFraction, true);
builder.AddResizingStep(image_width, image_height, false);
builder.AddPerChannelNormalizationStep(123.675, 116.28, 103.53, 1/57.0);
switch (input_format_.at(0).type) {
case DataType::Float32:
builder.AddPerChannelNormalizationStep(123.675, 116.28, 103.53, 1 / 57.0);
default:
builder.AddDefaultNormalizationStep();
}
preprocessing_stage_.reset(
new tflite::evaluation::ImagePreprocessingStage(builder.build()));
if (preprocessing_stage_->Init() != kTfLiteOk) {
Expand Down

0 comments on commit d08ee17

Please sign in to comment.