SlideShare a Scribd company logo
1 of 60
Download to read offline
國立臺北護理健康大學 NTUNHS
Image Detection
Orozco Hsu
2022-05-09
1
About me
• Education
• NCU (MIS)、NCCU (CS)
• Work Experience
• Telecom big data Innovation
• AI projects
• Retail marketing technology
• User Group
• TW Spark User Group
• TW Hadoop User Group
• Taiwan Data Engineer Association Director
• Research
• Big Data/ ML/ AIOT/ AI Columnist
2
Tutorial
Content
3
Useful dataset introduction
Homework
Image Detection (YOLOX)
Labeling images and create your own model
Code
• Download code
• https://github.com/orozcohsu/ntunhs_2022_01.git
• Folder/file
• 20220509_inter_master/run.ipynb
• 20220509_inter_master/split_voc.py
4
Code
5
Click button
Open it with Colab
Copy it to your
google drive
Check your google
drive
Object Detection
6
Object Detection
7
Object Detection Milestones
8
Ref: https://www.researchgate.net/figure/A-road-map-of-object-detection-Milestone-detectors-in-this-figure-VJ-Det-10-11-HOG_fig2_333077580
9
Input Image
Backbone Feature extraction from pre-train model (ImageNet); VGG16, ResNet, EfficientNet,
CSPDarknet53
Neck Integrates feature map from each layers; Using SPP or FPN or PAN…
Head Predicts bbox from those integrated feature map
• One-stage: predicts whether there is a bbox in each grid-cell (dense)
• Two-stage: predicts ROI only (sparse)
https://medium.com/mdbros/%E4%BA%94%E5%88%86%E9%90%98%E8%AA%8D%E8%AD%98%E7%94%A8-yolo-
%E5%81%9A%E8%A1%80%E6%B6%B2%E6%8A%B9%E7%89%87%E7%89%A9%E4%BB%B6%E5%81%B5%E6%B8%AC-object-detection-
be3c77e13228
10
Proposal-base
Two-Stage Detector
About YOLOX
• YOLOX is a high-performance anchor-free YOLO
• Exceeding YOLOV3, V4, V5
• With ONNX, TensorRT, OpenVINO
11
Jetson Nano + TensorRT
Rasperry Pi + OpenVINO
12
YOLOX Github
13
Ref: https://github.com/Megvii-BaseDetection/YOLOX
You Only Look Once
• YOLO divides the feature-map into small grid-cells
• Each grid is responsible for the detection of the targets at one time
• Predicting the bounding box
• Location
• Confidence of the targets
• Probability of all labels
14
15
Union the same label grid-cells and bolden the edge of box
Positive sample (bbox offset/ Regression)
Negative sample (background)
Ignore sample (not in the training labels)
16
The length depends on dataset label
X, Y : the central of grid-cell value
W, H: the prediction of object value
17
Anchor-Base/ Anchor-Free
18
Anchor-based:
Provide some pre-defined boxes (large and small)
Adjustment to scale the size of anchor for object prediction
https://medium.com/%E8%BB%9F%E9%AB%94%E4%B9%8B%E
5%BF%83/cv-object-detection-1-anchor-
free%E5%A4%A7%E7%88%86%E7%99%BC%E7%9A%842019%E
5%B9%B4-e3b4271cdf1a
Anchor-free:
Use FPN and focal loss
https://medium.com/%E8%BB%9F%E9%AB%94%E4%B9%8B%E
5%BF%83/%E9%80%9A%E5%BE%80anchor-
free%E7%9A%84%E7%9C%9F%E7%9B%B8-object-
detection%E7%9A%84%E6%AD%A3%E8%B2%A0%E6%A8%A3%
E6%9C%AC%E5%AE%9A%E7%BE%A9-83f2fe36167f
https://arxiv.org/pdf/1708.02002.pdf
Feature Pyramid Network (FPN)
19
Union the feature maps for prediction
https://arxiv.org/pdf/1612.03144.pdf
20
Loss function
• Classification loss
• Localization loss (the loss of G.T. box and prediction box)
• Confidence loss (object of the IOU box)
• Total loss:
• Classification loss + Localization loss + Confidence loss
21
Non-Maximum Suppression (NMS)
22
This is in the testing process (not in training process), because there is no G.T. bbox
23
YOLOX download: https://drive.google.com/file/d/1P7CkENy1qqoQqeZALFkEP_D4LUVZ9eH-/view?usp=sharing
24
25
26
27
28
29
30
31
32
33
34
35
36
PASCAL VOC Datasets
• PASCAL VOC
• Pattern Analysis Statistical and Computational Learning (Visual Object Classes)
• PASCAL VOC
• The dataset of image detection challenge of between 2005 and 2012
• In total, there are 20 labels
• PASCAL VOC 2007
• 9,963 images
• 24,640 annotation
• PASCAL VOC 2012
• 11,530 images
• 27,450 annotation
37
PASCAL VOC Datasets
• Person: person
• Animal: bird, cat, cow, dog, horse, sheep
• Vehicle: aero-plane, bicycle, boat, bus, car, motorbike, train
• Indoor: bottle, chair, dining-table, potted-plant, sofa, tv
38
20 labels
Rex: http://host.robots.ox.ac.uk/pascal/VOC/voc2012/index.html
MS COCO Datasets
• MS COCO
• Microsoft Common Object in Context
39
Ref: https://cocodataset.org/#home
Download LabelImg (For Windows)
• LabelImg
• Windows_v1.8.0
• Download: https://tzutalin.github.io/labelImg/
• Tutorial: https://tw.leaderg.com/article/index?sn=11159
40
Another annotation tool: http://www.jinglingbiaozhu.com/
LabelImg PACAL VOC
• PASCAL VOC (xml) annotation format
41
LabelImg YOLO
• YOLO annotation format
42
LabelImg
• Define the label in windows_v1.8.0datapredefined_classes.txt
• Open the LabelImg tool and go to 「Open Dir 」
• Zoom-in/out to scale your image and click 「Create RecBox 」
• Choose the label and 「Save 」
• Continue to label next image and click 「Next Image 」
43
LabelImg
44
LabelImg
• Go to your label folder, and check those files (PASCAL VOC)
• Double check the VOCdevkitVOC2007
45
YOLOX training
• Run the run.ipynb and go to CoLab (CoLab.ipynb)
• Make sure it is in GPU runtime
46
Config YOLOX
• Modify the YOLOX/exps/example/yolox_voc/yolox_voc_s.py
• Check YOLOX/exps/default for each proper depth and width
47
self.num_classes = 2
image_sets=[('2007', 'trainval')],
48
Config YOLOX
• Modify the YOLOX/yolox/data/datasets/voc_classes.py and
YOLOX/yolox/data/datasets/coco_classes.py
49
50
51
Consider to reduce the max epoch in YOLOX/yolox/exp/yolox_base.py
Config YOLOX
• Add executable path to train.py
52
YOLOX training
• Training command
53
python tools/train.py -f exps/example/yolox_voc/yolox_voc_s.py -d 1 -b 16 --fp16
-o -c yolox_s.pth
f: yolox configuration file
fp16: Half-precision floating-point format, refer to https://en.wikipedia.org/wiki/Half-precision_floating-point_format
d: define your GPU amont
b: define your batch size (adjust it for memory usage)
o: occupy GPU memory first for training
c: network weight file
YOLOX network output
54
YOLOX image testing
55
YOLOX output
56
YOLOX output
57
More
• Deploy model to edge device for real-time detection
• Edge device
• Use acceleration device on edge device
• TensorRT, OpenVINO
• No acceleration device on edge device
• https://medium.com/ching-i/yolo-fastest-ncnn-on-raspberry-pi-4-
f44143b44e45
• https://chtseng.wordpress.com/2020/09/27/%E8%A6%BA%E5%BE
%97yolo-
tiny%E4%B8%8D%E5%A4%A0%E5%BF%AB%E5%97%8E%EF%BC%
9F%E8%A9%A6%E8%A9%A6yolo-fastest/
58
More
• YOLOX resume from epoch
• https://chowdera.com/2021/11/20211119022033342w.html
• YOLOX documentation
• https://yolox.readthedocs.io/_/downloads/en/latest/pdf/
59
Homework
• Try to label other classes (more than 2) and rebuild your YOLOX
model (at least 1,500 images or more for training and testing data)
• https://blog.csdn.net/nan355655600/article/details/119519294
• If you want to use yolo label format
• https://d246810g2000.medium.com/%E5%A6%82%E4%BD%95%E4%BD%BF
%E7%94%A8%E8%87%AA%E5%B7%B1%E7%9A%84%E8%B3%87%E6%96%99
%E9%9B%86%E8%A8%93%E7%B7%B4-yolox-c02548734a48
60

More Related Content

Similar to 4_image_detection.pdf

2_Image Classification.pdf
2_Image Classification.pdf2_Image Classification.pdf
2_Image Classification.pdfFEG
 
Object detection and Instance Segmentation
Object detection and Instance SegmentationObject detection and Instance Segmentation
Object detection and Instance SegmentationHichem Felouat
 
Leveraging docker for hadoop build automation and big data stack provisioning
Leveraging docker for hadoop build automation and big data stack provisioningLeveraging docker for hadoop build automation and big data stack provisioning
Leveraging docker for hadoop build automation and big data stack provisioningEvans Ye
 
Leveraging Docker for Hadoop build automation and Big Data stack provisioning
Leveraging Docker for Hadoop build automation and Big Data stack provisioningLeveraging Docker for Hadoop build automation and Big Data stack provisioning
Leveraging Docker for Hadoop build automation and Big Data stack provisioningDataWorks Summit
 
IRJET- Object Detection and Recognition using Single Shot Multi-Box Detector
IRJET- Object Detection and Recognition using Single Shot Multi-Box DetectorIRJET- Object Detection and Recognition using Single Shot Multi-Box Detector
IRJET- Object Detection and Recognition using Single Shot Multi-Box DetectorIRJET Journal
 
INTRODUCTION TO MACHINE LEARNING FOR MATERIALS SCIENCE
INTRODUCTION TO MACHINE LEARNING FOR MATERIALS SCIENCEINTRODUCTION TO MACHINE LEARNING FOR MATERIALS SCIENCE
INTRODUCTION TO MACHINE LEARNING FOR MATERIALS SCIENCEIPutuAdiPratama
 
Using Deep Learning on Apache Spark to Diagnose Thoracic Pathology from Chest...
Using Deep Learning on Apache Spark to Diagnose Thoracic Pathology from Chest...Using Deep Learning on Apache Spark to Diagnose Thoracic Pathology from Chest...
Using Deep Learning on Apache Spark to Diagnose Thoracic Pathology from Chest...Databricks
 
Fast object re detection and localization in video for spatio-temporal fragme...
Fast object re detection and localization in video for spatio-temporal fragme...Fast object re detection and localization in video for spatio-temporal fragme...
Fast object re detection and localization in video for spatio-temporal fragme...MediaMixerCommunity
 
“A Practical Guide to Implementing ML on Embedded Devices,” a Presentation fr...
“A Practical Guide to Implementing ML on Embedded Devices,” a Presentation fr...“A Practical Guide to Implementing ML on Embedded Devices,” a Presentation fr...
“A Practical Guide to Implementing ML on Embedded Devices,” a Presentation fr...Edge AI and Vision Alliance
 
Fast object re-detection and localization in video for spatio-temporal fragme...
Fast object re-detection and localization in video for spatio-temporal fragme...Fast object re-detection and localization in video for spatio-temporal fragme...
Fast object re-detection and localization in video for spatio-temporal fragme...LinkedTV
 
Information from pixels
Information from pixelsInformation from pixels
Information from pixelsDave Snowdon
 
ICCV 2019 - A view
ICCV 2019 - A viewICCV 2019 - A view
ICCV 2019 - A viewLiberiFatali
 
AI Food detector; A model of Generative adversarial network for food Classifier
AI Food detector; A model of Generative adversarial network for food ClassifierAI Food detector; A model of Generative adversarial network for food Classifier
AI Food detector; A model of Generative adversarial network for food Classifierjimmy majumder
 
Jonathon Wright - Intelligent Performance Cognitive Learning (AIOps)
Jonathon Wright - Intelligent Performance Cognitive Learning (AIOps)Jonathon Wright - Intelligent Performance Cognitive Learning (AIOps)
Jonathon Wright - Intelligent Performance Cognitive Learning (AIOps)Neotys_Partner
 
Matchbox tool. Quality control for digital collections – SCAPE Training event...
Matchbox tool. Quality control for digital collections – SCAPE Training event...Matchbox tool. Quality control for digital collections – SCAPE Training event...
Matchbox tool. Quality control for digital collections – SCAPE Training event...SCAPE Project
 
[DLHacks]Introduction to ChainerCV
[DLHacks]Introduction to ChainerCV[DLHacks]Introduction to ChainerCV
[DLHacks]Introduction to ChainerCVDeep Learning JP
 
OpenCV @ Droidcon 2012
OpenCV @ Droidcon 2012OpenCV @ Droidcon 2012
OpenCV @ Droidcon 2012Wingston
 
Automated ML Workflow for Distributed Big Data Using Analytics Zoo (CVPR2020 ...
Automated ML Workflow for Distributed Big Data Using Analytics Zoo (CVPR2020 ...Automated ML Workflow for Distributed Big Data Using Analytics Zoo (CVPR2020 ...
Automated ML Workflow for Distributed Big Data Using Analytics Zoo (CVPR2020 ...Jason Dai
 
論文紹介:Transferable Decoding with Visual Entities for Zero-Shot Image Captioning
論文紹介:Transferable Decoding with Visual Entities for Zero-Shot Image Captioning論文紹介:Transferable Decoding with Visual Entities for Zero-Shot Image Captioning
論文紹介:Transferable Decoding with Visual Entities for Zero-Shot Image CaptioningToru Tamaki
 
Scalawox deeplearning
Scalawox deeplearningScalawox deeplearning
Scalawox deeplearningscalawox
 

Similar to 4_image_detection.pdf (20)

2_Image Classification.pdf
2_Image Classification.pdf2_Image Classification.pdf
2_Image Classification.pdf
 
Object detection and Instance Segmentation
Object detection and Instance SegmentationObject detection and Instance Segmentation
Object detection and Instance Segmentation
 
Leveraging docker for hadoop build automation and big data stack provisioning
Leveraging docker for hadoop build automation and big data stack provisioningLeveraging docker for hadoop build automation and big data stack provisioning
Leveraging docker for hadoop build automation and big data stack provisioning
 
Leveraging Docker for Hadoop build automation and Big Data stack provisioning
Leveraging Docker for Hadoop build automation and Big Data stack provisioningLeveraging Docker for Hadoop build automation and Big Data stack provisioning
Leveraging Docker for Hadoop build automation and Big Data stack provisioning
 
IRJET- Object Detection and Recognition using Single Shot Multi-Box Detector
IRJET- Object Detection and Recognition using Single Shot Multi-Box DetectorIRJET- Object Detection and Recognition using Single Shot Multi-Box Detector
IRJET- Object Detection and Recognition using Single Shot Multi-Box Detector
 
INTRODUCTION TO MACHINE LEARNING FOR MATERIALS SCIENCE
INTRODUCTION TO MACHINE LEARNING FOR MATERIALS SCIENCEINTRODUCTION TO MACHINE LEARNING FOR MATERIALS SCIENCE
INTRODUCTION TO MACHINE LEARNING FOR MATERIALS SCIENCE
 
Using Deep Learning on Apache Spark to Diagnose Thoracic Pathology from Chest...
Using Deep Learning on Apache Spark to Diagnose Thoracic Pathology from Chest...Using Deep Learning on Apache Spark to Diagnose Thoracic Pathology from Chest...
Using Deep Learning on Apache Spark to Diagnose Thoracic Pathology from Chest...
 
Fast object re detection and localization in video for spatio-temporal fragme...
Fast object re detection and localization in video for spatio-temporal fragme...Fast object re detection and localization in video for spatio-temporal fragme...
Fast object re detection and localization in video for spatio-temporal fragme...
 
“A Practical Guide to Implementing ML on Embedded Devices,” a Presentation fr...
“A Practical Guide to Implementing ML on Embedded Devices,” a Presentation fr...“A Practical Guide to Implementing ML on Embedded Devices,” a Presentation fr...
“A Practical Guide to Implementing ML on Embedded Devices,” a Presentation fr...
 
Fast object re-detection and localization in video for spatio-temporal fragme...
Fast object re-detection and localization in video for spatio-temporal fragme...Fast object re-detection and localization in video for spatio-temporal fragme...
Fast object re-detection and localization in video for spatio-temporal fragme...
 
Information from pixels
Information from pixelsInformation from pixels
Information from pixels
 
ICCV 2019 - A view
ICCV 2019 - A viewICCV 2019 - A view
ICCV 2019 - A view
 
AI Food detector; A model of Generative adversarial network for food Classifier
AI Food detector; A model of Generative adversarial network for food ClassifierAI Food detector; A model of Generative adversarial network for food Classifier
AI Food detector; A model of Generative adversarial network for food Classifier
 
Jonathon Wright - Intelligent Performance Cognitive Learning (AIOps)
Jonathon Wright - Intelligent Performance Cognitive Learning (AIOps)Jonathon Wright - Intelligent Performance Cognitive Learning (AIOps)
Jonathon Wright - Intelligent Performance Cognitive Learning (AIOps)
 
Matchbox tool. Quality control for digital collections – SCAPE Training event...
Matchbox tool. Quality control for digital collections – SCAPE Training event...Matchbox tool. Quality control for digital collections – SCAPE Training event...
Matchbox tool. Quality control for digital collections – SCAPE Training event...
 
[DLHacks]Introduction to ChainerCV
[DLHacks]Introduction to ChainerCV[DLHacks]Introduction to ChainerCV
[DLHacks]Introduction to ChainerCV
 
OpenCV @ Droidcon 2012
OpenCV @ Droidcon 2012OpenCV @ Droidcon 2012
OpenCV @ Droidcon 2012
 
Automated ML Workflow for Distributed Big Data Using Analytics Zoo (CVPR2020 ...
Automated ML Workflow for Distributed Big Data Using Analytics Zoo (CVPR2020 ...Automated ML Workflow for Distributed Big Data Using Analytics Zoo (CVPR2020 ...
Automated ML Workflow for Distributed Big Data Using Analytics Zoo (CVPR2020 ...
 
論文紹介:Transferable Decoding with Visual Entities for Zero-Shot Image Captioning
論文紹介:Transferable Decoding with Visual Entities for Zero-Shot Image Captioning論文紹介:Transferable Decoding with Visual Entities for Zero-Shot Image Captioning
論文紹介:Transferable Decoding with Visual Entities for Zero-Shot Image Captioning
 
Scalawox deeplearning
Scalawox deeplearningScalawox deeplearning
Scalawox deeplearning
 

More from FEG

Sequence Model pytorch at colab with gpu.pdf
Sequence Model pytorch at colab with gpu.pdfSequence Model pytorch at colab with gpu.pdf
Sequence Model pytorch at colab with gpu.pdfFEG
 
學院碩士班_非監督式學習_使用Orange3直接使用_分群_20240417.pdf
學院碩士班_非監督式學習_使用Orange3直接使用_分群_20240417.pdf學院碩士班_非監督式學習_使用Orange3直接使用_分群_20240417.pdf
學院碩士班_非監督式學習_使用Orange3直接使用_分群_20240417.pdfFEG
 
資料視覺化_透過Orange3進行_無須寫程式直接使用_碩士學程_202403.pdf
資料視覺化_透過Orange3進行_無須寫程式直接使用_碩士學程_202403.pdf資料視覺化_透過Orange3進行_無須寫程式直接使用_碩士學程_202403.pdf
資料視覺化_透過Orange3進行_無須寫程式直接使用_碩士學程_202403.pdfFEG
 
Pytorch cnn netowork introduction 20240318
Pytorch cnn netowork introduction 20240318Pytorch cnn netowork introduction 20240318
Pytorch cnn netowork introduction 20240318FEG
 
2023 Decision Tree analysis in business practices
2023 Decision Tree analysis in business practices2023 Decision Tree analysis in business practices
2023 Decision Tree analysis in business practicesFEG
 
2023 Clustering analysis using Python from scratch
2023 Clustering analysis using Python from scratch2023 Clustering analysis using Python from scratch
2023 Clustering analysis using Python from scratchFEG
 
2023 Data visualization using Python from scratch
2023 Data visualization using Python from scratch2023 Data visualization using Python from scratch
2023 Data visualization using Python from scratchFEG
 
2023 Supervised Learning for Orange3 from scratch
2023 Supervised Learning for Orange3 from scratch2023 Supervised Learning for Orange3 from scratch
2023 Supervised Learning for Orange3 from scratchFEG
 
2023 Supervised_Learning_Association_Rules
2023 Supervised_Learning_Association_Rules2023 Supervised_Learning_Association_Rules
2023 Supervised_Learning_Association_RulesFEG
 
202312 Exploration Data Analysis Visualization (English version)
202312 Exploration Data Analysis Visualization (English version)202312 Exploration Data Analysis Visualization (English version)
202312 Exploration Data Analysis Visualization (English version)FEG
 
202312 Exploration of Data Analysis Visualization
202312 Exploration of Data Analysis Visualization202312 Exploration of Data Analysis Visualization
202312 Exploration of Data Analysis VisualizationFEG
 
Image Classification (20230411)
Image Classification (20230411)Image Classification (20230411)
Image Classification (20230411)FEG
 
Google CoLab (20230321)
Google CoLab (20230321)Google CoLab (20230321)
Google CoLab (20230321)FEG
 
Supervised Learning
Supervised LearningSupervised Learning
Supervised LearningFEG
 
UnSupervised Learning Clustering
UnSupervised Learning ClusteringUnSupervised Learning Clustering
UnSupervised Learning ClusteringFEG
 
Data Visualization in Excel
Data Visualization in ExcelData Visualization in Excel
Data Visualization in ExcelFEG
 
6_Association_rule_碩士班第六次.pdf
6_Association_rule_碩士班第六次.pdf6_Association_rule_碩士班第六次.pdf
6_Association_rule_碩士班第六次.pdfFEG
 
5_Neural_network_碩士班第五次.pdf
5_Neural_network_碩士班第五次.pdf5_Neural_network_碩士班第五次.pdf
5_Neural_network_碩士班第五次.pdfFEG
 
4_Regression_analysis.pdf
4_Regression_analysis.pdf4_Regression_analysis.pdf
4_Regression_analysis.pdfFEG
 
3_Decision_tree.pdf
3_Decision_tree.pdf3_Decision_tree.pdf
3_Decision_tree.pdfFEG
 

More from FEG (20)

Sequence Model pytorch at colab with gpu.pdf
Sequence Model pytorch at colab with gpu.pdfSequence Model pytorch at colab with gpu.pdf
Sequence Model pytorch at colab with gpu.pdf
 
學院碩士班_非監督式學習_使用Orange3直接使用_分群_20240417.pdf
學院碩士班_非監督式學習_使用Orange3直接使用_分群_20240417.pdf學院碩士班_非監督式學習_使用Orange3直接使用_分群_20240417.pdf
學院碩士班_非監督式學習_使用Orange3直接使用_分群_20240417.pdf
 
資料視覺化_透過Orange3進行_無須寫程式直接使用_碩士學程_202403.pdf
資料視覺化_透過Orange3進行_無須寫程式直接使用_碩士學程_202403.pdf資料視覺化_透過Orange3進行_無須寫程式直接使用_碩士學程_202403.pdf
資料視覺化_透過Orange3進行_無須寫程式直接使用_碩士學程_202403.pdf
 
Pytorch cnn netowork introduction 20240318
Pytorch cnn netowork introduction 20240318Pytorch cnn netowork introduction 20240318
Pytorch cnn netowork introduction 20240318
 
2023 Decision Tree analysis in business practices
2023 Decision Tree analysis in business practices2023 Decision Tree analysis in business practices
2023 Decision Tree analysis in business practices
 
2023 Clustering analysis using Python from scratch
2023 Clustering analysis using Python from scratch2023 Clustering analysis using Python from scratch
2023 Clustering analysis using Python from scratch
 
2023 Data visualization using Python from scratch
2023 Data visualization using Python from scratch2023 Data visualization using Python from scratch
2023 Data visualization using Python from scratch
 
2023 Supervised Learning for Orange3 from scratch
2023 Supervised Learning for Orange3 from scratch2023 Supervised Learning for Orange3 from scratch
2023 Supervised Learning for Orange3 from scratch
 
2023 Supervised_Learning_Association_Rules
2023 Supervised_Learning_Association_Rules2023 Supervised_Learning_Association_Rules
2023 Supervised_Learning_Association_Rules
 
202312 Exploration Data Analysis Visualization (English version)
202312 Exploration Data Analysis Visualization (English version)202312 Exploration Data Analysis Visualization (English version)
202312 Exploration Data Analysis Visualization (English version)
 
202312 Exploration of Data Analysis Visualization
202312 Exploration of Data Analysis Visualization202312 Exploration of Data Analysis Visualization
202312 Exploration of Data Analysis Visualization
 
Image Classification (20230411)
Image Classification (20230411)Image Classification (20230411)
Image Classification (20230411)
 
Google CoLab (20230321)
Google CoLab (20230321)Google CoLab (20230321)
Google CoLab (20230321)
 
Supervised Learning
Supervised LearningSupervised Learning
Supervised Learning
 
UnSupervised Learning Clustering
UnSupervised Learning ClusteringUnSupervised Learning Clustering
UnSupervised Learning Clustering
 
Data Visualization in Excel
Data Visualization in ExcelData Visualization in Excel
Data Visualization in Excel
 
6_Association_rule_碩士班第六次.pdf
6_Association_rule_碩士班第六次.pdf6_Association_rule_碩士班第六次.pdf
6_Association_rule_碩士班第六次.pdf
 
5_Neural_network_碩士班第五次.pdf
5_Neural_network_碩士班第五次.pdf5_Neural_network_碩士班第五次.pdf
5_Neural_network_碩士班第五次.pdf
 
4_Regression_analysis.pdf
4_Regression_analysis.pdf4_Regression_analysis.pdf
4_Regression_analysis.pdf
 
3_Decision_tree.pdf
3_Decision_tree.pdf3_Decision_tree.pdf
3_Decision_tree.pdf
 

Recently uploaded

Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdfChristopherTHyatt
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 

Recently uploaded (20)

Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdf
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 

4_image_detection.pdf

  • 2. About me • Education • NCU (MIS)、NCCU (CS) • Work Experience • Telecom big data Innovation • AI projects • Retail marketing technology • User Group • TW Spark User Group • TW Hadoop User Group • Taiwan Data Engineer Association Director • Research • Big Data/ ML/ AIOT/ AI Columnist 2
  • 3. Tutorial Content 3 Useful dataset introduction Homework Image Detection (YOLOX) Labeling images and create your own model
  • 4. Code • Download code • https://github.com/orozcohsu/ntunhs_2022_01.git • Folder/file • 20220509_inter_master/run.ipynb • 20220509_inter_master/split_voc.py 4
  • 5. Code 5 Click button Open it with Colab Copy it to your google drive Check your google drive
  • 8. Object Detection Milestones 8 Ref: https://www.researchgate.net/figure/A-road-map-of-object-detection-Milestone-detectors-in-this-figure-VJ-Det-10-11-HOG_fig2_333077580
  • 9. 9 Input Image Backbone Feature extraction from pre-train model (ImageNet); VGG16, ResNet, EfficientNet, CSPDarknet53 Neck Integrates feature map from each layers; Using SPP or FPN or PAN… Head Predicts bbox from those integrated feature map • One-stage: predicts whether there is a bbox in each grid-cell (dense) • Two-stage: predicts ROI only (sparse) https://medium.com/mdbros/%E4%BA%94%E5%88%86%E9%90%98%E8%AA%8D%E8%AD%98%E7%94%A8-yolo- %E5%81%9A%E8%A1%80%E6%B6%B2%E6%8A%B9%E7%89%87%E7%89%A9%E4%BB%B6%E5%81%B5%E6%B8%AC-object-detection- be3c77e13228
  • 11. About YOLOX • YOLOX is a high-performance anchor-free YOLO • Exceeding YOLOV3, V4, V5 • With ONNX, TensorRT, OpenVINO 11 Jetson Nano + TensorRT Rasperry Pi + OpenVINO
  • 12. 12
  • 14. You Only Look Once • YOLO divides the feature-map into small grid-cells • Each grid is responsible for the detection of the targets at one time • Predicting the bounding box • Location • Confidence of the targets • Probability of all labels 14
  • 15. 15 Union the same label grid-cells and bolden the edge of box Positive sample (bbox offset/ Regression) Negative sample (background) Ignore sample (not in the training labels)
  • 16. 16 The length depends on dataset label X, Y : the central of grid-cell value W, H: the prediction of object value
  • 17. 17
  • 18. Anchor-Base/ Anchor-Free 18 Anchor-based: Provide some pre-defined boxes (large and small) Adjustment to scale the size of anchor for object prediction https://medium.com/%E8%BB%9F%E9%AB%94%E4%B9%8B%E 5%BF%83/cv-object-detection-1-anchor- free%E5%A4%A7%E7%88%86%E7%99%BC%E7%9A%842019%E 5%B9%B4-e3b4271cdf1a Anchor-free: Use FPN and focal loss https://medium.com/%E8%BB%9F%E9%AB%94%E4%B9%8B%E 5%BF%83/%E9%80%9A%E5%BE%80anchor- free%E7%9A%84%E7%9C%9F%E7%9B%B8-object- detection%E7%9A%84%E6%AD%A3%E8%B2%A0%E6%A8%A3% E6%9C%AC%E5%AE%9A%E7%BE%A9-83f2fe36167f https://arxiv.org/pdf/1708.02002.pdf
  • 19. Feature Pyramid Network (FPN) 19 Union the feature maps for prediction https://arxiv.org/pdf/1612.03144.pdf
  • 20. 20
  • 21. Loss function • Classification loss • Localization loss (the loss of G.T. box and prediction box) • Confidence loss (object of the IOU box) • Total loss: • Classification loss + Localization loss + Confidence loss 21
  • 22. Non-Maximum Suppression (NMS) 22 This is in the testing process (not in training process), because there is no G.T. bbox
  • 24. 24
  • 25. 25
  • 26. 26
  • 27. 27
  • 28. 28
  • 29. 29
  • 30. 30
  • 31. 31
  • 32. 32
  • 33. 33
  • 34. 34
  • 35. 35
  • 36. 36
  • 37. PASCAL VOC Datasets • PASCAL VOC • Pattern Analysis Statistical and Computational Learning (Visual Object Classes) • PASCAL VOC • The dataset of image detection challenge of between 2005 and 2012 • In total, there are 20 labels • PASCAL VOC 2007 • 9,963 images • 24,640 annotation • PASCAL VOC 2012 • 11,530 images • 27,450 annotation 37
  • 38. PASCAL VOC Datasets • Person: person • Animal: bird, cat, cow, dog, horse, sheep • Vehicle: aero-plane, bicycle, boat, bus, car, motorbike, train • Indoor: bottle, chair, dining-table, potted-plant, sofa, tv 38 20 labels Rex: http://host.robots.ox.ac.uk/pascal/VOC/voc2012/index.html
  • 39. MS COCO Datasets • MS COCO • Microsoft Common Object in Context 39 Ref: https://cocodataset.org/#home
  • 40. Download LabelImg (For Windows) • LabelImg • Windows_v1.8.0 • Download: https://tzutalin.github.io/labelImg/ • Tutorial: https://tw.leaderg.com/article/index?sn=11159 40 Another annotation tool: http://www.jinglingbiaozhu.com/
  • 41. LabelImg PACAL VOC • PASCAL VOC (xml) annotation format 41
  • 42. LabelImg YOLO • YOLO annotation format 42
  • 43. LabelImg • Define the label in windows_v1.8.0datapredefined_classes.txt • Open the LabelImg tool and go to 「Open Dir 」 • Zoom-in/out to scale your image and click 「Create RecBox 」 • Choose the label and 「Save 」 • Continue to label next image and click 「Next Image 」 43
  • 45. LabelImg • Go to your label folder, and check those files (PASCAL VOC) • Double check the VOCdevkitVOC2007 45
  • 46. YOLOX training • Run the run.ipynb and go to CoLab (CoLab.ipynb) • Make sure it is in GPU runtime 46
  • 47. Config YOLOX • Modify the YOLOX/exps/example/yolox_voc/yolox_voc_s.py • Check YOLOX/exps/default for each proper depth and width 47 self.num_classes = 2 image_sets=[('2007', 'trainval')],
  • 48. 48
  • 49. Config YOLOX • Modify the YOLOX/yolox/data/datasets/voc_classes.py and YOLOX/yolox/data/datasets/coco_classes.py 49
  • 50. 50
  • 51. 51 Consider to reduce the max epoch in YOLOX/yolox/exp/yolox_base.py
  • 52. Config YOLOX • Add executable path to train.py 52
  • 53. YOLOX training • Training command 53 python tools/train.py -f exps/example/yolox_voc/yolox_voc_s.py -d 1 -b 16 --fp16 -o -c yolox_s.pth f: yolox configuration file fp16: Half-precision floating-point format, refer to https://en.wikipedia.org/wiki/Half-precision_floating-point_format d: define your GPU amont b: define your batch size (adjust it for memory usage) o: occupy GPU memory first for training c: network weight file
  • 58. More • Deploy model to edge device for real-time detection • Edge device • Use acceleration device on edge device • TensorRT, OpenVINO • No acceleration device on edge device • https://medium.com/ching-i/yolo-fastest-ncnn-on-raspberry-pi-4- f44143b44e45 • https://chtseng.wordpress.com/2020/09/27/%E8%A6%BA%E5%BE %97yolo- tiny%E4%B8%8D%E5%A4%A0%E5%BF%AB%E5%97%8E%EF%BC% 9F%E8%A9%A6%E8%A9%A6yolo-fastest/ 58
  • 59. More • YOLOX resume from epoch • https://chowdera.com/2021/11/20211119022033342w.html • YOLOX documentation • https://yolox.readthedocs.io/_/downloads/en/latest/pdf/ 59
  • 60. Homework • Try to label other classes (more than 2) and rebuild your YOLOX model (at least 1,500 images or more for training and testing data) • https://blog.csdn.net/nan355655600/article/details/119519294 • If you want to use yolo label format • https://d246810g2000.medium.com/%E5%A6%82%E4%BD%95%E4%BD%BF %E7%94%A8%E8%87%AA%E5%B7%B1%E7%9A%84%E8%B3%87%E6%96%99 %E9%9B%86%E8%A8%93%E7%B7%B4-yolox-c02548734a48 60