Giter VIP home page Giter VIP logo

Comments (4)

SniperPancake avatar SniperPancake commented on May 30, 2024 2

Thank you very much for help! I've checked and it works for me as well!

from play_with_tensorrt.

iwatake2222 avatar iwatake2222 commented on May 30, 2024

Please check and modify the settings in the following lines for your model.
https://github.com/iwatake2222/play_with_tensorrt/blob/master/pj_tensorrt_det_yolox/image_processor/detection_engine.cpp#L44
L44 - L50

I tested YOLOX tiny (https://github.com/PINTO0309/PINTO_model_zoo/blob/main/132_YOLOX/download_tiny.sh ), and it worked. However, I didn't test larger models such as YOLOX-m and YOLOX-l. The possibility is that these models need different post-process logic or parameters than YOLOX-tiny, -nano.
If you could share your ONNX model, I'll test it. Maybe you can upload (drag&drop) the model here.

from play_with_tensorrt.

SniperPancake avatar SniperPancake commented on May 30, 2024

Hi, thanks for quick response. I'll look into the code soon. Meanwhile, since models weigh 100 to 200 MB each and I was unable to upload them to github, here is the link to my drive containing these models:
https://drive.google.com/drive/folders/1ZOQUw5eoPOA7WtTBYDyP1MIyxupYY6GR?usp=sharing
I also uploaded video I was using for testing.

from play_with_tensorrt.

iwatake2222 avatar iwatake2222 commented on May 30, 2024

Hi, I got it worked! Please modify detection_engine.cpp like the followings.
The point is input data normalization. The ONNX model exported from the original repo expects input data in the range of 0 - 255. However, my code uses another model which was converted in a different way and expects input data in the range of around -2.2 - 2.2 (or 0.0 - 1.0).

diff --git a/pj_tensorrt_det_yolox/image_processor/detection_engine.cpp b/pj_tensorrt_det_yolox/image_processor/detection_engine.cpp
index 6f87969..08df8e3 100644
--- a/pj_tensorrt_det_yolox/image_processor/detection_engine.cpp
+++ b/pj_tensorrt_det_yolox/image_processor/detection_engine.cpp
@@ -41,12 +41,12 @@ limitations under the License.
 #define PRINT_E(...) COMMON_HELPER_PRINT_E(TAG, __VA_ARGS__)

 /* Model parameters */
-#define MODEL_NAME  "yolox_nano_480x640.onnx"
+#define MODEL_NAME  "yolox_m_736x1280.onnx"
 #define TENSORTYPE  TensorInfo::kTensorTypeFp32
 #define INPUT_NAME  "images"
-#define INPUT_DIMS  { 1, 3, 480, 640 }
+#define INPUT_DIMS  { 1, 3, 736, 1280 }
 #define IS_NCHW     true
-#define IS_RGB      true
+#define IS_RGB      false
 #define OUTPUT_NAME "output"

 static constexpr int32_t kGridScaleList[] = { 8, 16, 32 };
@@ -69,12 +69,12 @@ int32_t DetectionEngine::Initialize(const std::string& work_dir, const int32_t n
     InputTensorInfo input_tensor_info(INPUT_NAME, TENSORTYPE, IS_NCHW);
     input_tensor_info.tensor_dims = INPUT_DIMS;
     input_tensor_info.data_type = InputTensorInfo::kDataTypeImage;
-    input_tensor_info.normalize.mean[0] = 0.485f;
-    input_tensor_info.normalize.mean[1] = 0.456f;
-    input_tensor_info.normalize.mean[2] = 0.406f;
-    input_tensor_info.normalize.norm[0] = 0.229f;
-    input_tensor_info.normalize.norm[1] = 0.224f;
-    input_tensor_info.normalize.norm[2] = 0.225f;
+    input_tensor_info.normalize.mean[0] = 0.0f;
+    input_tensor_info.normalize.mean[1] = 0.0f;
+    input_tensor_info.normalize.mean[2] = 0.0f;
+    input_tensor_info.normalize.norm[0] = 1.0f / 255.0f;
+    input_tensor_info.normalize.norm[1] = 1.0f / 255.0f;
+    input_tensor_info.normalize.norm[2] = 1.0f / 255.0f;
     input_tensor_info_list_.push_back(input_tensor_info);

image

from play_with_tensorrt.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.