Ver Fonte

完善分类中的均值方差预处理

leon há 5 meses atrás
pai
commit
5daf423a93
1 ficheiros alterados com 5 adições e 1 exclusões
  1. 5 1
      src/resnet.cu

+ 5 - 1
src/resnet.cu

@@ -344,7 +344,11 @@ class InferImpl : public Infer {
     network_input_height_ = input_dim[2];
     isdynamic_model_ = trt_->has_dynamic_dim();
 
-    normalize_ = Norm::alpha_beta(1 / 255.0f, 0.0f, ChannelType::SwapRB);
+    // normalize_ = Norm::alpha_beta(1 / 255.0f, 0.0f, ChannelType::SwapRB);
+    // [0.485, 0.456, 0.406], [0.229, 0.224, 0.225]
+    float mean[3] = {0.485, 0.456, 0.406}; 
+    float std[3] = {0.229, 0.224, 0.225};
+    normalize_ = Norm::mean_std(mean, std, 1/255.0,  ChannelType::SwapRB);
     num_classes_ = trt_->static_dims(1)[1];
     return true;
   }