-
Notifications
You must be signed in to change notification settings - Fork 211
Fine tuned model to onnx/tensorrt/tflite conversion? #31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
onnx: from rfdetr import RFDETRBase
x = RFDETRBase()
x.export() then afterward in bash if you want fp16 trt: trtexec --onnx=output/inference_model.onnx --fp16 we havent tested tflite yet |
if anyone wants to share their experience getting it working with tflite that would be cool! |
Hey, i"m trying to run my custom .trt model, but base class "RFDETR" don"t support .trt models, if i correct understand. and error - Failed to load pretrain weights: invalid load key, 'f'. |
Please share inference code using trt model. |
I am successfully able to convert to tflite. I have created following PR with inference code- |
we don't have built-in infra to serve trt models. we assumed people using trt would have their own infra. can you say more about your use case? are there other detector repos that you have used that provide native trt serving? @Artem-N @dsbyprateekg |
Yes @isaacrob-roboflow . I have been using Yolov7, which provides all steps to convert to onnx/tensorrt and also has provided a notebook for trt inference- https://colab.research.google.com/github/WongKinYiu/yolov7/blob/main/tools/YOLOv7trt.ipynb |
so far, as an experiment I have used the infrastructure from ultralytics in my orin nx 16gb board In order to run the rf-detr model on video and run it in real time I have modified the code a little and a`m running it from my machine on the rtx4090 well. But it is interesting to try to run your model on a jetson board (orin nx 16gb) and for this it is clearly necessary to do this with the model converted to tensorflow, for speed up. Here code what i use for running: import cv2 custom_labels = ["person", "car", "truck"] model = RFDETRBase(num_classes=3, video_source = r"source.mp4" total_frames = int(cap.get(cv2.CAP_PROP_FRAME_COUNT)) ret, frame = cap.read() rgb_frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB) color = sv.ColorPalette.from_hex([ base_text_scale = sv.calculate_optimal_text_scale(resolution_wh=resolution) base_thickness = sv.calculate_optimal_line_thickness(resolution_wh=resolution) bbox_annotator = sv.BoxAnnotator(color=color, thickness=thickness) label_annotator = sv.LabelAnnotator( cap.set(cv2.CAP_PROP_POS_FRAMES, 0) frame_skip = 2 # Process every 2nd frame progress = tqdm(total=total_frames, desc="Processing Video Frames") while True:
progress.close() and when i change here - model = RFDETRBase(num_classes=3, in general i use ultralytics, but also can use yolov7 architectures. |
@dsbyprateekg |
trtexec --onnx=output/inference_model.onnx --fp16 Hi, @probicheaux |
that's the right command! trt engines aren't generally cross-platform compatible so you will likely have to do it on the jetson itself. also, we suggest using jetpack 6.2, which comes with trt 10.3. newer versions of trt come with speedups for the particular architecture we use for our backbone, and we benchmark with trt 10.4 |
@Ben93kie I'm able to run it with deepstream Steps
|
ok, wow thx @Willjay90 I'll try it out tmrw |
Hi @Ben93kie, |
Please share the notebook/code to convert the fine-tuned model to onnx/tensort/tflite format and their inference code.
The text was updated successfully, but these errors were encountered: