일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
- lgenius
- sk
- awscloud
- lg합격
- SK인턴
- lg인적성모의고사
- lg인재상
- lg인성검사
- DT
- e1인턴
- cloudfoundations
- aws
- LGD
- awsacademy
- 데이터분석
- 2022awscloudbootcamp
- awscloudbootcamp
- lg인적성합격
- LG인적성
- 2022awscloud
- cloudarchitecting
- lg디스플레이lgenius
- lg디스플레이산학장학생
- SKT
- LG인적성후기
- SKC&C
- lg적성검사
- aws클라우드부트캠프
- LG디스플레이
- sktai
- Today
- Total
냥냥파워
YoloV5 Detector로 OCR 데이터셋 한글 검출하기 본문
https://github.com/ultralytics/yolov5
GitHub - ultralytics/yolov5: YOLOv5 🚀 in PyTorch > ONNX > CoreML > TFLite
YOLOv5 🚀 in PyTorch > ONNX > CoreML > TFLite. Contribute to ultralytics/yolov5 development by creating an account on GitHub.
github.com
yoloV5 공식 github에 가면
custom dataset 세팅부터
train, validation, test까지
설명이 자세하게 나와있다
AI 프로젝트 때도 욜로 모델을 사용했기에
이번 OCR 옛한글 detector 업무도
해당 github의 detector.py 파일과
작년에 학습한 weights 파일을 사용했다
(yolov5) D:\고혜정YOLO>python detect.py --weights data/best.pt --img 640 --conf 0.25 --source data/yolo_ocr_dataset/train/images
anaconda3 prompt에 만들어둔 가상환경에 접속해서
해당 command line을 입력하면
다음과 같은 내용이 출력되면서
사진 한 장씩 detection이 실시된다
data/yolo_ocr_dataset/train/images
detect: weights=['data/best.pt'], source=data/yolo_ocr_dataset/train/images, data=data\coco128.yaml, imgsz=[640, 640], conf_thres=0.25, iou_thres=0.45, max_det=1000, device=, view_img=False, save_txt=False, save_conf=False, save_crop=False, nosave=False, classes=None, agnostic_nms=False, augment=False, visualize=False, update=False, project=runs\detect, name=exp, exist_ok=False, line_thickness=3, hide_labels=False, hide_conf=False, half=False, dnn=False
YOLOv5 2022-6-12 Python-3.8.13 torch-1.11.0 CUDA:0 (NVIDIA GeForce GTX 1080 Ti, 11264MiB)
Fusing layers...
YOLOv5l6 summary: 476 layers, 76118664 parameters, 0 gradients
detection 결과는
runs\detect\exp 폴더에서 확인 가능하다
이후 val.py 파일로 test도 진행했다
(yolov5) D:\YOLO>python val.py --data "D:\yolo_ocr_dataset\test.yaml" --weights "D:\YOLO\best.pt" --task test
test.yaml 파일에는
validation 또는 test에서 사용하기 위한
파일 경로와 class 정보를 넣어야 한다
path : D:/YOLO/yolo_custom_dataset
train : train/images
val : validation/images
test : all/images
nc : 1
names : ['text']
val.py에서 task를 test로 지정하면
해당 이미지셋에 대한 테스트를 할 수 있다
테스트 결과는 다음과 같다
val: data=D:\yolo_ocr_dataset\test.yaml, weights=['D:\\YOLO\\best.pt'], batch_size=32, imgsz=640, conf_thres=0.001, iou_thres=0.6, task=test, device=, workers=8, single_cls=False, augment=False, verbose=False, save_txt=False, save_hybrid=False, save_conf=False, save_json=False, project=runs\val, name=exp, exist_ok=False, half=False, dnn=False
YOLOv5 2022-6-12 Python-3.8.13 torch-1.11.0 CUDA:0 (NVIDIA GeForce GTX 1080 Ti, 11264MiB)
Fusing layers...
YOLOv5l6 summary: 476 layers, 76118664 parameters, 0 gradients
test: Scanning 'D:\YOLO\custom_dataset\all\labels' images and labels...729 found, 1 missing, 0 empty, 0 corrupt: 100%|██████████| 730/730 [00:06<00:00, 105.46it/s]
test: New cache created: D:\YOLO\custom_dataset\all\labels.cache
Class Images Labels P R mAP@.5 mAP@.5:.95: 4%|▍ | 1/23 [00:21<07:48, 21.31s/it] WARNING: NMS time limit 1.260s exceeded
Class Images Labels P R mAP@.5 mAP@.5:.95: 9%|▊ | 2/23 [00:27<04:23, 12.53s/it] WARNING: NMS time limit 1.260s exceeded
Class Images Labels P R mAP@.5 mAP@.5:.95: 13%|█▎ | 3/23 [00:34<03:16, 9.81s/it] WARNING: NMS time limit 1.260s exceeded
Class Images Labels P R mAP@.5 mAP@.5:.95: 30%|███ | 7/23 [00:57<01: Class Images Labels P R mAP@.5 mAP@.5:.95: 35%|███▍ Cl Class Images Labels P R mAP@.5 mAP@.5:.95: 48%|████▊ | 11/23 [01:17<01:03, 5.25s/it] Class Images Labels P R mAP@.5 mAP@.5:.95: 52%|█████▏ | 12/23 [01:22<00:57, 5.23s/it] Class Images Labels P R mAP@.5 mAP@.5:.95: 57%|█████▋ | 13/23 [01:27<00:50, 5.07s/it] Class Images Labels P R mAP@.5 mAP@.5:.95: 61%|██████ | 14/23 [01:32<00:45, 5.11s/it] Class Images Labels P R mAP@.5 mAP@.5:.95: 65%|██████▌ | 15/23 [01:37<00:40, 5.11s/it] Class Images Labels P R mAP@.5 mAP@.5:.95: 70%|██████▉ | 16/23 [01:42<00:34, 4.98s/it] Class Images Labels P R mAP@.5 mAP@.5:.95: 74%|███████▍ | 17/23 [01:46<00:27, 4.62s/it] Class Images Labels P R mAP@.5 mAP@.5:.95: 78%|███████▊ | 18/23 [01:48<00:19, 3.90s/it] Class Images Labels P R mAP@.5 mAP@.5:.95: 83%|████████▎ | 19/23 [01:51<00:14, 3.54s/it] Class Images Labels P R mAP@.5 mAP@.5:.95: 87%|████████▋ | 20/23 [01:53<00:09, 3.30s/it] Class Images Labels P R mAP@.5 mAP@.5:.95: 91%|█████████▏| 21/23 [01:56<00:06, 3.10s/it] Class Images Labels P R mAP@.5 mAP@.5:.95: 96%|█████████▌| 22/23 [01:59<00:02, 2.99s/it] Class Images Labels P R mAP@.5 mAP@.5:.95: 100%|██████████| 23/23 [02:02<00:00, 3.03s/it] Class Images Labels P R mAP@.5 mAP@.5:.95: 100%|██████████| 23/23 [02:02<00:00, 5.32s/it]
all 730 99316 1 0.997 0.995 0.924
Speed: 0.2ms pre-process, 19.7ms inference, 8.0ms NMS per image at shape (32, 3, 640, 640)
Results saved to runs\val\exp44
detection 결과는 데이터셋 보호(?)를 위해
공개를 하지 않고,
test 결과 생성된 성능 지표를 첨부한다
'POSTECH AI연구원 인턴' 카테고리의 다른 글
Image Classification with ResNet50 in Pytorch (0) | 2022.06.20 |
---|---|
RuntimeError: cuda runtime error(10): invalid device ordinal (0) | 2022.06.17 |
RuntimeError: CUDA error: device-side assert triggered (0) | 2022.06.16 |
YOLACT : Real Time instance segmentation (0) | 2022.06.07 |
Digitization of Old Korean Texts with Obsolete Korean Characters andSuggestion for Improvement of Information Sharing (0) | 2022.06.07 |