当前位置:网站首页>Target detection notes - overview and common data sets
Target detection notes - overview and common data sets
2022-07-28 22:53:00 【leu_ mon】
Overview and common data sets
0. summary
- Want to have Classification of network Related basic knowledge

- Target detection is divided into two categories :One-Stage,Two-Stage
1.Two-Stage: Faster R-CNN
1) Go through special modules Generate candidate boxes (RPN), Looking for the future as well as Adjust the bounding box ( be based on anchors)
2) Based on the previously generated candidate box Further classify and adjust the bounding box ( be based on proposals)
2.One-Stage: SSD,YOLO
be based on anchors Directly classify and adjust the bounding box
One-Stage,Two-Stage contrast :One-Stage testing Faster ,Two-Stage testing More accurate
1.TF Official API
up See the video for details https://www.bilibili.com/video/BV1KE411E7Ch?spm_id_from=333.999.0.0
2.PASCAL VOC2012 Data sets
- Click on **Download the training/validation data (2GB tar file)** download
- There are mainly 20 Categories , It is divided into 4 Categories:

- Dataset catalog

- Usage method :
- Read train.txt Each line of information in the file ( Image name )
- stay Annotations Find the corresponding .xml file
- adopt .xml file You can get picture information ( Width , Height , Target location, etc )
- stay JPEGImages Find the corresponding picture under the folder , Load memory .
3. MS COCO Data set and usage

There are Object80 class and stuff91 class ,Object80 Class is stuff91 Class A subset of , Generally, target detection only needs Object80 class , Let's see the usage scenarios .
be relative to PASCAL VOC The effect of pre training is better , But it takes more time .
Coco Data sets Official website :http://cocodataset.org/
SkyDrive address : link :https://pan.baidu.com/s/1_kQBJxB019cXpzfqNz7ANA Extraction code :m6s5


bilibili up Explain the video :https://www.bilibili.com/video/BV1TK4y1o78H?spm_id_from=333.999.0.0
Recommended blog links :https://blog.csdn.net/qq_37541097/article/details/112248194
github link :https://github.com/WZMIAOMIAO/deep-learning-for-image-processing
For more details, please see the official website document :http://cocodataset.org/#format-data
Ps: It is meaningless to divide the test set with your own data , Because the data distribution is basically the same
import json
# see json The data structure of the file
json_path = "G:/coco2017/annotations/instances_val2017.json"
json_labels = json.load(open(json_path,"r"))
print(json_labels)
# >>>json_label
# |-info: Describe file information
# |-licenses: No impact information
# |-image:5000 Two elements correspond to 5000 A picture , Contains picture information
# |-annotations:3w+ Elements correspond to 3w+ The goal is
# | |-segmentation: Split information
# | |-area: area
# | |-iscrowed: Is it overlapping , Generally, only 0 Training for
# | |-image_id: picture id
# | |-bbox: Mark box information ( Left upper coordinate , Length and width )
# | |_category_id: Category name
# |_categories:80 Two elements correspond to 80 Classes
# PS:categories in id Discontinuous , Pay attention during training .
# About coco Official tools pycocotools Installation
# liunx:pip install pycocotools
# windows:pip install pycocotools-windows
import os
from pycocotools.coco import COCO
from PIL import Image,ImageDraw
import matplotlib.pyplot as plt
json_path = "G:/coco2017/annotations/instances_val2017.json"
img_path = "G:/coco2017/val2017"
# Import coco data
coco = COCO(annotation_file=json_path)
# Get the index of all pictures
ids = list(sorted(coco.imgs.keys()))
print("number of image:%d"%len(ids))
# Get everything coco Category labels
coco_classes = dict([(v["id"], v["name"]) for k,v in coco.cats.items()])
# Traverse the first three pictures
for img_id in ids[:3]:
# Obtain the corresponding image id All of the annotations ids Information
ann_ids = coco.getAnnIds(img_id)
# according to annotations idx Information get all annotation information
targets = coco.loadAnns(ann_ids)
# Get the name of the image file
path = coco.loadImgs(img_id)[0]["file_name"]
# Read the image according to the path , Convert to RGB Format
img = Image.open(os.path.join(img_path,path)).convert('RGB')
# Drawing pictures
draw = ImageDraw.Draw(img)
# Draw the target box
for target in targets:
x,y,w,h = target["bbox"] # Extract the target box information
x1,y1,x2,y2 = x,y,int(x+w),int(y+h) # Calculate the coordinate
draw.rectangle((x1,y1,x2,y2)) # Draw the target box
draw.text((x1,y1),coco_classes[target["category_id"]]) # Drawing class name
# display picture
plt.imshow(img)
plt.show()
# coco File form of target detection results in
''' [{ "image_id" :int, # Record the image to which the target belongs id "category_id" :int, # Record the category index that predicts the target "bbox" :[x,y,w,h] # Record the bounding box information that predicts the target "score" :float # Record the probability of predicting the goal }] '''
# The output of training results is saved as json form , Compare with the results on the validation set
from pycocotools.coco import COCO
from pycocotools.cocoeval import COCOeval
# Load the dimension file of the validation set
coco_ture = COCO(annotation_file="./val_2017.json")
# Load network at coco2017 Verify the prediction results on the set
coco_pre = coco_ture.loadRes('./predict_results.json')
# Output the effect of prediction , indicators mAP, See section 5 Section
coco_evaluator = COCOeval(cocoGt=coco_ture, cocoDt=coco_pre, iouType="bbox")
coco_evaluator.evaluate()
coco_evaluator.accumulate()
coco_evaluator.summarize()
4. Create your own data set LabelImg&Labelme
LabelImg Generated are xml File with the VOC2012 Agreement
Labelme It's not just the sample that can mark the target detection , Other sample annotations such as semantic segmentation can also be carried out .
- Download and install :
pip install labelImg - Input
labelImgOpen software

5. object detection coco Common indicators
TP(True Positive):IOU>0.5 Number of detection frames ( same Ground Truth Calculate only once ).
FP(Flase Positive):IOU<=0.5 The detection frame of ( Or the same... Is detected Ground Truth Redundant detection box ) The number of .
FN(False Negative): Not detected Ground Truth The number of .
Precision( Precision rate ):TP/(TP+FP) Of all the goals predicted by the model , Predict the right proportion .
Recall( Recall rate ):TP/(TP+FN) Among all real targets , The model predicts the correct target proportion .
AP(Average Precision): P-R(Precision-Recall) Area under curve .
mAP(mean Average Precision): That is, each category AP Average value
边栏推荐
- Paper reading vision gnn: an image is worth graph of nodes
- LeetCode练习3——回文数
- C language to realize string reverse order arrangement
- 776. String shift inclusion problem
- Yolov5 improvement 4: add ECA channel attention mechanism
- Stm32subeide (10) -- ADC scans multiple channels in DMA mode
- 软件测试工具fiddler postman jmeter charlse核心功能总结
- 无代码开发平台通讯录导出入门教程
- 771. The longest consecutive character in a string
- Stm32+ four pin OLED screen + Chinese character mold taking
猜你喜欢

Shell script foundation - shell operation principle + variable and array definitions

OSV_ q AttributeError: ‘numpy. ndarray‘ object has no attribute ‘clone‘

How to delete and remove the first row of elements in PHP two-dimensional array

《Shortening passengers’ travel time A dynamic metro train scheduling approach using deep reinforcem》

STM32_ Hal library driven framework

Intelligent control -- fuzzy mathematics and control

WinForm jump to the second form case

Improvement 13 of yolov5: replace backbone network C3 with lightweight network efficientnetv2

STM32 - advanced control timer (time base unit, functional block diagram, input, capture, output, open circuit)

What to do after mathematical modeling gets the competition problem and some ("crooked ways") tips - must see before the competition
随机推荐
一份来自奎哥的全新MPLS笔记,考IE必看 ----尚文网络奎哥
Anaconda environment installation skimage package
Labelme labels circular objects [tips]
希捷发布全新RISC-V架构处理器:机械硬盘相关性能暴涨3倍
《结构学》介绍
Improvement 11 of yolov5: replace backbone network C3 with lightweight network mobilenetv3
Yolov5 improvement 6: add small target detection layer
PC side web page effects (client series, scroll series, immediate function execution, sidebar effects)
can‘t convert cuda:0 device type tensor to numpy. Use Tensor. cpu() to copy the tensor to host memory
hp proliant dl380从U盘启动按哪个键
PCA学习
776. String shift inclusion problem
Use the picture name to label the picture [tips]
MKD [anomaly detection: knowledge disruption]
STM32 board level support package for keys
LeetCode练习3——回文数
Yolov5 improvement 5: improve the feature fusion network panet to bifpn
赋能中国芯创业者!看摩尔精英如何破解中小芯片企业发展难题
【三维目标检测】3DSSD(二)
es个人整理的相关面试题