ajithkumarmcw / Yolo_tflite_detection

2 stars 0 forks source link

float32 yolov8 #1

Open brooklynsdeath opened 4 months ago

brooklynsdeath commented 4 months ago

How did you do the preprocessing for yolov8? can you provide the code snippet after the invoke is called or tell me what changes need to be done.

ajithkumarmcw commented 4 months ago

Use python and check your code .

  1. Letterbox transformation same as Yolov8
  2. BGR to RGB conversion
brooklynsdeath commented 4 months ago

sorry i wanted to know about the post processing steps, it is getting difficult for me to get the correct output from tensor if (status != kTfLiteOk) { std::cout << "\nFailed to run inference!!\n"; exit(1); } // For YOLOv8 out_dims = interpreter->tensor(model_output)->dims; int out_batch = out_dims->data[0]; int _out_row = out_dims->data[2];
int _out_colum = out_dims->data[1]; std::cout << "YOLO Model Output Shape:[" << out_batch << "][" << _out_row << "][" << _out_colum << "]\n"; std::vector<std::vector> predV ; pOutputTensor = interpreter->tensor(model_output);

my o/p YOLO Model Output Shape:[1][8400][7]

I have swapped this beacuse yolov8 deos opposite to yolov5 yolov8 int _out_row = out_dims->data[2];
int _out_colum = out_dims->data[1];

yolov5 int _out_row = out_dims->data[1];
int _out_colum = out_dims->data[2];

ajithkumarmcw commented 4 months ago

I believe this should work . did u checked it ? https://github.com/ajithkumarmcw/Yolo_tflite_detection/blob/main/src/yolov5_tflite.cpp#L239-L266

brooklynsdeath commented 4 months ago

yes i have performed it, and still i'm not getting any better results // yolov5 has an output of shape (batchSize, 25200, 85) (Num classes + box[x,y,w,h] + confidence[c]) // yolov8 has an output of shape (batchSize, 84, 8400) (Num classes + box[x,y,w,h])

that is why i changed it

ajithkumarmcw commented 4 months ago

could u share u r post processing code and output image the only postprocessing step is apply cv2.nms and write the bounding boxes to image .

quocnhat commented 3 weeks ago

Hi, Can you please share the source code implemented for yolov8 tflite cpp ? thanks in advance,

ajithkumarmcw commented 3 weeks ago

Either share your mail id or send mail to inocajith21.5@gmail.com

quocnhat commented 3 weeks ago

@ajithkumarmcw thanks for your reply, I've sent email, please take a look. For yolov5 tflite, I have successfully built and run https://github.com/muhammedakyuzlu/yolov5-tflite-cpp. However, this repo built done but could not run. Return core-dump after load model successfully. Thanks for any advice.

ajithkumarmcw commented 3 weeks ago

In case if any one faces issue kindly use this repo https://github.com/ajithvcoder/Yolov8_CPP_Inference_tflite