In this chapter you will learn about Object Detection and Image Segmentation. We will explore a lot of things one by one. Lets talk about them one by one:-
Object Detection labels:- These are different from classification labels where you just provided subfolders with different class images
Detection Evaluation Metric:- Different from classification where we talk about accuracy (no. of correct), we will mention mAP, IOU here
Detection Loss:- Along with the Cross-Entropy loss you also have Regression Loss
Detection Network:- Then there's the network details.
Go through the https://github.com/jhilikb/UCS668/blob/main/Detection/Object%20Detection.pdf slowly to explore these in details.
Practice 7: You will find a streamlit based chapter at https://github.com/jhilikb/UCS668
Prerequisite: Make sure that you have the Detection folder in your course folder UCS668.
Start your python environment (say ucs668) that you set up (in Lab0) for the course using source ucs668/bin/activate (on your terminal if you use Linux/Mac) or using .\ucs668\Scripts\Activate.ps1 (on your powershell if using windows). In both cases you should be in the folder where you created the environment
cd Detection
streamlit run det.py
You will see the chapter start on your browser. In your browser, you can now explore the example tasks and understand how to solve them.
Practice 8: You will find a streamlit based chapter at https://github.com/jhilikb/UCS668
Prerequisite: Make sure that you have the Segmentation folder in your course folder UCS668.
Start your python environment (say ucs668) that you set up (in Lab0) for the course using source ucs668/bin/activate (on your terminal if you use Linux/Mac) or using .\ucs668\Scripts\Activate.ps1 (on your powershell if using windows). In both cases you should be in the folder where you created the environment
cd Segmentation
streamlit run seg.py
You will see the chapter start on your browser. In your browser, you can now explore the example tasks and understand how to solve them.
Lab 5: -Implement Yolo26 (https://docs.ultralytics.com/models/yolo26 ) with pretrained weights and save bounding box if class is person
i) Use the saved person to train a classifier with 2 classes, attentive, distracted -use transfer learning with any pretrained classifier
ii) merge the two steps so that your overall code first runs yolo and detects person and then classifies the person as attentive or distracted
Points to note:
-use a small yolo version ex. Yolo 26 s
-when you save images running yolo, do pose variations with different friends. Make sure to collect minimum 450-500 images.
-yolo is trained with coco dataset. Check the label file of coco to check the class number.
-ex. output of detection model for a image with 25 objects detected
Class number 25*1
Bounding box 25*4
Score 25*1
a. Open mapcoco.txt and check class number for person…manually
b. Get yolo26s (may be) running…modify the predict part, so that you can pass i)camera feed ii) check the output for class number and bounding box iii)if class number matches, you will save the bounding box
c. Train classifier for your sorted images
d. Combine the detection classification pipeline
Lab 6
-Use a standard Detection Model, say Yolo26 to detect person, car, dog , etc
-You should be using continuous camera feed
- In your image, check the detection classes and give the user for removal option
For example: if you have people and a dog in your picture, ask the user if he wants the dog removed.
if you have a scene with very small people, ask if you want the person removed
Implementation hint:-
a. Check the size of the detection w.r.t your image size and consider say 20% to be removal criteria
b. When the user wants the object removed, use the object bounding box and fill the box with pixels around the box.
Bb: x1,y1,x2,y2
I[y1:y2,x1:x2,:]=…avg_patch.
h=y2-y1
w=x2-x1
An example h *w patch on the left of x1,y1
Sam1= I [ y1:y1+h , x1-w:x1,:]
An example h *w patch on the right of x2,y1
Sam2= I [ y1:y1+h , x2:x2+w,:]