Slicing Aided Hyper Inference for Small Object Detection - SAHI

  Рет қаралды 6,413

LearnOpenCV

LearnOpenCV

Күн бұрын

📚 Blog post Link: learnopencv.com/slicing-aided...
📚 Check out our FREE Courses at OpenCV University : opencv.org/university/free-co...
Small object detection focuses on identifying and pinpointing tiny objects within digital images. This task is made difficult due to the limited size and pixel representation of these objects, alongside challenges like reduced visibility and a low signal-to-noise ratio.
There are many modern object detection techniques available, such as Faster RCNN, YOLO, SSD, RetinaNet, EfficientDet, and more. Most of these models are trained using the COCO (Common Objects in Context) dataset. This dataset is vast and offers a wide variety of object categories and annotations, making it a prime option for training object detection algorithms. However, a curious observation is that these models often struggle with small object detection. An approach like "Slicing Aided Hyper Inference for Small Object Detection - SAHI" could be a potential solution to this problem. Isn't that thought-provoking?
⭐️ Time Stamps:⭐️
00:00-00:10: Introduction
00:10-00:58: SAHI
00:58-05:30: Code Snippets
05:30-05:44: Outro
Resources:
🖥️ On our blog - learnopencv.com we also share tutorials and code on topics like Image
Processing, Image Classification, Object Detection, Face Detection, Face Recognition, YOLO, Segmentation, Pose Estimation, and many more using OpenCV(Python/C++), PyTorch, and TensorFlow.
🤖 Learn from the experts on AI: Computer Vision and AI Courses
YOU have an opportunity to join the over 5300+ (and counting) researchers, engineers, and students that have benefited from these courses and take your knowledge of computer vision, AI, and deep learning to the next level.🤖
opencv.org/courses
#️⃣ Connect with Us #️⃣
📝 Linkedin: / satyamallick
📱 Twitter: / learnopencv
🔊 Facebook: profile.php?...
📸 Instagram: / learnopencv
🔗 Reddit: / spmallick
🔖Hashtags🔖
#SAHI #ObjectDetection #SmallObjectDetection #MachineLearning #ArtificialIntelligence #DeepLearning #AI #COCODataset #YOLO #EfficientDet #RetinaNet #SSD #FasterRCNN #AIDetection #opencvunibersity #deeplearning #computervision #learnopencv #opencv

Пікірлер: 29
@vahidbehtaji8863
@vahidbehtaji8863 11 ай бұрын
Hats off to you 👏
@pranavdurai
@pranavdurai 11 ай бұрын
Pleasure!
@cyberhard
@cyberhard 11 ай бұрын
The way it is started, it makes it sound like yolov8s is for small objects. It isn't. The "s" is to signify it is a small model and has less parameters than larger models. It is quite possible that a model with more parameters would find small objects with SAHI.
@LearnOpenCV
@LearnOpenCV 11 ай бұрын
You are correct. The 's' stands for small model. Even though it has less number of parameters, it can infer over images quicker. Although a bigger model will detect a few small objects in the frame, the inference trade off will be quite high. Using SAHI in these cases is beneficial.
@jannataziz2436
@jannataziz2436 20 сағат бұрын
where can we get code of your this project ?
@vigneshsuvarna9452
@vigneshsuvarna9452 11 ай бұрын
good one thanks for sharing
@pranavdurai
@pranavdurai 11 ай бұрын
Really glad!
@jimvanvorst1696
@jimvanvorst1696 11 ай бұрын
It seems this is just running inference on 1:1 resolution instead of rescaling the whole image to the model resolution? Doesn't this multiply your inference time by N for every frame? Would it be better to create a model with the resolution which matches your input? I.e. train a 1920x1080 model instead of dividing the 1080 image into a grid and running inference on every tile.
@pranavdurai
@pranavdurai 11 ай бұрын
Thank you for your comment! You're right; the SAHI technique in this implementation divides the image into patches, which can increase inference time. For efficiency, resizing the entire image or training a model with the desired resolution might be a better choice. However, SAHI can still be useful for challenging small object detection tasks. The approach depends on the trade-offs between accuracy, speed, and resource constraints in the application.
@taiuc2923
@taiuc2923 4 ай бұрын
i have train a YOLOv8m with custom dataset (not pretrained) can i use SAHI to load my own model instead of a yolov8 pretrained model
@fariz6152
@fariz6152 4 ай бұрын
same questions
@LearnOpenCV
@LearnOpenCV 4 ай бұрын
It depends on where you want to use SAHI. As of now, there is support for using it during inference and training. And yes, you can load and train YOLOv8M from scratch + integrate SAHI during the training procedure as well.
@taiuc2923
@taiuc2923 3 ай бұрын
@@LearnOpenCV apply sahi with RT-Detr on ultralytics ?
@LearnOpenCV
@LearnOpenCV 3 ай бұрын
Yes you can@@taiuc2923
@taiuc2923
@taiuc2923 3 ай бұрын
@@LearnOpenCV detection_model = AutoDetectionModel.from_pretrained( model_type='yolov8', model_path=r"/content/drive/MyDrive/AI_city/best (1).pt", confidence_threshold=0.3, device='cuda:0', ) what i need to pass in model_type when i want to use RT-DETR from ultralytics
@ameliapuspa7230
@ameliapuspa7230 2 ай бұрын
how to train datasets using Yolov8 and SAHI?
@LearnOpenCV
@LearnOpenCV Ай бұрын
Please refer to: github.com/obss/sahi
@JohnWandeto
@JohnWandeto 15 күн бұрын
Must one have installed fiftyone package?
@LearnOpenCV
@LearnOpenCV 11 күн бұрын
No need to install it explicitly. The requirements.txt file will take care of all the necessary dependancies.
@christophertubig8267
@christophertubig8267 4 ай бұрын
can you share the notebook pls?
@LearnOpenCV
@LearnOpenCV 4 ай бұрын
Training notebook is already provided in the accompanying blog post. Ref: learnopencv.com/slicing-aided-hyper-inference/
@renatoherrig776
@renatoherrig776 11 ай бұрын
I am following your tutorial using jupyter notebook in my desktop, but when I try to visualize the sliced results I have this error: error: OpenCV(4.7.0) D:\a\opencv-python\opencv-python\opencv\modules\imgproc\src\color.cpp:182: error: (-215:Assertion failed) !_src.empty() in function 'cv::cvtColor'
@LearnOpenCV
@LearnOpenCV 11 ай бұрын
Hi, could you please verify you are reading the the image correctly? This error states that the image is empty. In other words, image has not been read.
@renatoherrig776
@renatoherrig776 11 ай бұрын
@@LearnOpenCV Thank you for your help! I do not understand why my code is not running. It seems that the code try to classify the image, but when I try to save the image I do not have any information, even if I specify the directory. I tested in different software like pycharm, jupyter notebook, without success. This is my code # Import required functions and classes from sahi import AutoDetectionModel from sahi.utils.cv import read_image from sahi.utils.file import download_from_url from sahi.predict import get_prediction, get_sliced_prediction, predict from sahi.prediction import visualize_object_predictions from IPython.display import Image from numpy import asarray import cv2 # Download YOLOv8 model yolov8_model_path = "C:/Users/renat/Área de Trabalho/sahi/yolov8m.pt" detection_model = AutoDetectionModel.from_pretrained( model_type='yolov8', model_path=yolov8_model_path, confidence_threshold=0.4, device="cuda:0" ) result = get_sliced_prediction( "C:/Users/renat/sahi/small-vehicles1.jpeg", detection_model, slice_height = 256, slice_width = 256, overlap_height_ratio = 0.7, overlap_width_ratio = 0.7 ) result.export_visuals(export_dir="C:/Users/renat/Área de Trabalho/")
@user-jo8tt7ph4h
@user-jo8tt7ph4h 4 ай бұрын
how to add a custom label in this code
@LearnOpenCV
@LearnOpenCV 4 ай бұрын
Please refer to SAHI's official documentation - they have a param for custom label visualization. Ref: github.com/obss/sahi
@moatasem444
@moatasem444 7 ай бұрын
missing implementing on webcam!
@user-jo8tt7ph4h
@user-jo8tt7ph4h 4 ай бұрын
how to add a custom label in this code
@LearnOpenCV
@LearnOpenCV 3 ай бұрын
Please refer to SAHI's official documentation - they have a param for custom label visualization. Ref: github.com/obss/sahi
HOW DID HE WIN? 😱
00:33
Topper Guild
Рет қаралды 20 МЛН
DO YOU HAVE FRIENDS LIKE THIS?
00:17
dednahype
Рет қаралды 69 МЛН
Survival skills: A great idea with duct tape #survival #lifehacks #camping
00:27
How to detect small objects with SAHI and YOLO
16:36
Nicolai Nielsen
Рет қаралды 16 М.
YOLOv9 vs YOLOv10: A Comprehensive Comparison
1:17
Amenity Technologies
Рет қаралды 97
Simple YOLOv8 Object Detection & Tracking with StrongSORT & ByteTrack
21:44
Tackling the Small Object Problem in Object Detection
9:32
Roboflow
Рет қаралды 12 М.
YOLOv8 | Image Segmentation On Custom Dataset using YOLOv8
12:47
Code With Aarohi
Рет қаралды 23 М.
HOW DID HE WIN? 😱
00:33
Topper Guild
Рет қаралды 20 МЛН