Comments (3)
Hi, @sivaji123256 👋🏻!
I think you can do it much easier. You have two options.
- If you want to filter by area. Here is the docs link.
detections = detections[detections.area > AREA_TRESHOLD]
- If you want to filter by box dimensions, the solution is a bit more hacky but quite concise.
w = detections.xyxy[:, 2] - detections.xyxy[:, 0]
h = detections.xyxy[:, 3] - detections.xyxy[:, 1]
detections = detections[(w > WIDTH_TRESHOLD) & (h > HEIGHT_TRESHOLD)]
You put that filtering part under grounding_dino_model.predict_with_classes
call.
detections = grounding_dino_model.predict_with_classes(
image=image,
classes=enhance_class_name(class_names=CLASSES),
box_threshold=BOX_TRESHOLD,
text_threshold=TEXT_TRESHOLD
)
<<HERE>>
box_annotator = sv.BoxAnnotator()
labels = [
f"{CLASSES[class_id]} {confidence:0.2f}" if class_id is not None else f"{'other'} {confidence:0.2f}"
for _, _, confidence, class_id, _
in detections]
annotated_frame = box_annotator.annotate(scene=image.copy(), detections=detections, labels=labels)
from notebooks.
👋 Hello @sivaji123256, thank you for leaving an issue on Roboflow Notebooks.
🐞 Bug reports
If you are filing a bug report, please be as detailed as possible. This will help us more easily diagnose and resolve the problem you are facing. To learn more about contributing, check out our Contributing Guidelines.
If you require support with custom code that is not part of Roboflow Notebooks, please reach out on the Roboflow Forum or on the GitHub Discussions page associated with this repository.
💬 Get in touch
Do you have more questions about Roboflow that we haven't responded to yet? Feel free to ask them on the Roboflow Discuss forum. Our developer advocates and community team actively respond to questions there.
To ask questions about Notebooks, head over to the GitHub Discussions section of this repository.
from notebooks.
I'm closing the issue. Feel free to reopen in case you'll have more questions.
from notebooks.
Related Issues (20)
- Unable to run evaluation with the provided trained model
- unable to train data on roboflow100 dataset
- Counting Bug
- Counting Bug
- Unable to Move to Next Image During Labeling
- Incompatibility with latest supervision version: no detections_to_voc_xml
- error in classification model which i had built a few days ago HOT 1
- Tuple Unpack Problem in Byte Tracker of Supervision: 0.18.0 HOT 3
- Related to the blog post of speed estimation using supervision HOT 3
- Yolov6 inference runtime error
- Model doesn't train with a custom dataset
- Transformer based image classifier
- Counting based on different Categories of Fishes ( Instead of In and out)
- add DCGAN
- Feature Request: Tool for Measuring Time Spent on Object Detection and Tracking
- AttributeError: module 'supervision' has no attribute 'BoxAnnotator' HOT 6
- Could not open video at /content/subway.mp4 HOT 2
- AttributeError: module 'numpy.linalg._umath_linalg' has no attribute '_ilp64'
- ImportError: libgthread-2.0.so.0: cannot open shared object file: No such file or directory HOT 2
- Error download LOCO dataset using mt-yolov6 format
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 notebooks.