Comments (4)
Without more context it is hard to tell
- Where did you get yolov7.onnx?
- Does it have the nms/postprocessing included?
- Can you share the onnx model?
- What image/video are you testing it with?
from onnx-yolov7-object-detection.
I fixed that. In my case, the output of onnx model has three outputs. Onnx models which you shared in the read.me file just concatenate these three outputs. I solved by adding some script to concatenate these outputs. You can see the last layer of my onnx model below.
I also added these first seven lines to the YOLOV7.py file to concatenate the outputs shown in the image above. That function is in the 72 th line.
def process_output(self, output):
predictions0 = np.squeeze(output[0])
predictions1 = np.squeeze(output[1])
predictions2 = np.squeeze(output[2])
predictions0=predictions0.reshape(-1, predictions0.shape[-1])
predictions1=predictions1.reshape(-1, predictions1.shape[-1])
predictions2=predictions2.reshape(-1, predictions2.shape[-1])
predictions = np.concatenate((predictions0, predictions1,predictions2), axis=0)
# Filter out object confidence scores below threshold
obj_conf = predictions[:, 4]
predictions = predictions[obj_conf > self.conf_threshold]
obj_conf = obj_conf[obj_conf > self.conf_threshold]
# Multiply class confidence with bounding box confidence
predictions[:, 5:] *= obj_conf[:, np.newaxis]
# Get the scores
scores = np.max(predictions[:, 5:], axis=1)
print(scores)
# Filter out the objects with a low score
predictions = predictions[scores > self.conf_threshold]
scores = scores[scores > self.conf_threshold]
print(predictions)
print("predictions result",predictions.shape)
print("scores result",scores.shape)
if len(scores) == 0:
return [], [], []
# Get the class with the highest confidence
class_ids = np.argmax(predictions[:, 5:], axis=1)
# Get bounding boxes for each object
boxes = self.extract_boxes(predictions)
print(boxes)
# Apply non-maxima suppression to suppress weak, overlapping bounding boxes
indices = nms(boxes, scores, self.iou_threshold)
print(indices)
print(scores)
return boxes[indices], scores[indices], class_ids[indices]
Now,I am not getting any bbox output from the visualizer. I guess there is a problem in my onnx file. Which onnx converter did you use to convert .pt file to .onnx file. I used the converter in the yolov7 repository (https://github.com/WongKinYiu/yolov7/blob/main/export.py) . But the last layer isn't like yours last layer. Also, I am getting warning while converting. If you share your onnx converter scirpt I will be very pleasure. Also, could you state onnxruntime version? Thanks in advance.
from onnx-yolov7-object-detection.
https://drive.google.com/file/d/1m3y6dlm78J_WvVXHKuIARBkzqwBqRyFw/view?usp=sharing (Coverted yolov7,pt file in yolov7 repository)
This onnx model is not same as the photo which I shared. However, I also could not get any bounding box output for this onnx model. It just shows the image without any bboxes. I also tried to use your yolov7-tiny_480x640.onnx model. It easily detects the cars in the photo.
from onnx-yolov7-object-detection.
Sorry for the delay, looking at that output, it looks like an issue during export, make sure to add the "--grid" parameter when you export the model.
from onnx-yolov7-object-detection.
Related Issues (20)
- Unclear which onnx file to get from Pinto_model_zoo HOT 4
- cannot import name 'YOLOv7' from 'yolov7' HOT 11
- yolov7 export settings for use with a custom dataset HOT 5
- Exception useCuda = true
- Doubt about official_nms HOT 1
- Onnx boxes to opencv boxes HOT 1
- 100% CPU usage while HOT 1
- how to do filter for classes that i want to detect HOT 1
- Can not run on cpu HOT 2
- how to convert pt to onnx? HOT 1
- Fatal error: TRT:EfficientNMS_TRT(-1) is not a registered function/op
- Here the code for GPU but it seems, doesn't run fast
- Floating Point 16 ONNX model conversion
- Run innx on my GPU ?
- Handling of low socre in process_output HOT 2
- Hi, could you tell how to convert original yolov7 model to onnx? HOT 1
- decode HOT 1
- Only detect persons and bicycles HOT 2
- It is crash In the NMS mode. HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from onnx-yolov7-object-detection.