일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- #실생활영어
- #opencv
- keras
- 영어명언
- python 알고리즘
- TensorFlow
- text2img
- #영어 명언
- 이미지 생성
- 딥러닝
- tokenizing
- opencv SURF
- object detection
- #English
- #Android
- Convolution Neural Network
- #프로젝트
- #일상영어
- python __init__
- 영어
- 완전탐색
- convexhull
- #영어
- findContours
- python list
- c언어
- word embedding
- tensorflow update
- #1일1영어
- #실생활 영어
- Today
- Total
When will you grow up?
ImageAI 를 활용한 15줄짜리 object detection 본문
더욱 자세한 정보는
https://towardsdatascience.com/object-detection-with-10-lines-of-code-d6cb4d86f606
Object Detection with 10 lines of code
Part 2 of this tutorial for detecting your custom objects is available via this link.
towardsdatascience.com
여기 글을 참고해서 포스팅합니다.
문제가 생길시, 지우도록하겠습니다.
faster rcnn, yolo 등 다양한 오브젝트 디텍션 모델들이 나와있지만, 초보자가 사용하기가 힘든 문제점이 있다.
그래서 이번에는 아주 간단하지만 괜찮은 성능을 보여주는 간단한 코딩을 해볼 예정이다.
사전에 앞서,
실습환경: jupyter lab
version : python3.7, keras, tensorflow, matplot, imageai 모듈이 깔려있다고 가정한다.
ImageAI는 pip install imageai 명령어를 통해 간편하게 설치할 수 있다.
또한 실습에 필요한 pre-trained 된 모델은 retinanet을 이용하였으며, link< 여기서 받을 수 있다.
위 그림처럼 결과를 얻을 수 있으며, 아마 coco dataset기반으로 pretrained 된 모델이니 디텍션 결과 종류를 얻을 수 있을 것이다.
그리고 조금만 수정한다면 실시간으로 처리하고 하는 부분도 가능할꺼같다.
전체소스 코드
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
import numpy as np import matplotlib.pyplot as plt from matplotlib.image import imread from imageai.Detection import ObjectDetection import os detector = ObjectDetection() detector.setModelTypeAsRetinaNet() detector.setModelPath("model/resnet50_coco_best_v2.0.1.h5") detector.loadModel() detections = detector.detectObjectsFromImage(input_image="input_images/image.jpg", output_image_path="output_images/image.jpg") for eachObject in detections: print(eachObject["name"] , " : " , eachObject["percentage_probability"] ) img = imread('output_images/image.jpg') plt.imshow(img) |
cs |
만약 coco dataset 처럼 custom 데이터와 위치정보 라벨된 데이터셋이 있어서 학습을 시키고 싶다면,
아래 코드로 간편하게 학습도 가능한거 같다.
결국 데이터가 ..ㅠ
https://medium.com/deepquestai/train-object-detection-ai-with-6-lines-of-code-6d087063f6ff
Train Object Detection AI with 6 lines of code
Step-by-step tutorial on training object detection models on your own dataset
medium.com
'02. Study > Tensorflow' 카테고리의 다른 글
conda 환경으로 tensorflow gpu 2.0 / 1.x 버전 관리하기 (10) | 2019.11.13 |
---|---|
[Error]Could not find 'cudnn64_6.dll' (0) | 2018.01.07 |
Anaconda(spyder)를 이용한 Tensorflow Object Detection API (4) | 2017.07.17 |
Anaconda를 이용한 tensorflow update 하기 (0) | 2017.05.11 |
Tensorflow로 Logistic(Binary) Classification 구현하기 (0) | 2017.01.24 |