전체 글 64

[mmdetection] custom dataset 학습방법

오늘은 custom dataset(육계 데이터셋)을 이용해 mmdetection model을 training하는 방법을 정리하고자 한다. 1. training.py file 생성 from mmdet.apis import init_detector, inference_detector import mmcv import torch import cv2 from mmdet.datasets.builder import DATASETS from mmdet.datasets.coco import CocoDataset from mmcv import Config print(f"Setup complete. Using torch {torch.__version__} ({torch.cuda.get_device_properties(0)..

[mmdetection] 탐지 개체수 설정방법

mmdetection에는 이미지 하나당 감지될 수 있는 개체수가 정해져있다. (default 100) 내가 다루는 데이터의 경우 하나의 이미지에 보통 2~300개의 instance가 존재하므로 위 설정을 바꿀 필요가 있었다. 변경방법은 다음과 같다. mmdetection/configs/_base_/models/mask_rcnn_r50_fpn.py 위 파일에서 맨 아래부분의 test_cfg 부분을 살펴보면 rcnn 내부에 max_per_img 이 변수가 하나의 이미지에서 탐지할 수 있는 최대 개체수 파라미터다. 해당 파라미터를 1000으로 변경하면 최대 1000개까지 instance를 탐지할 수 있다. test_cfg=dict( rpn=dict( nms_pre=1000, max_per_img=1000, n..

[mmdetection] bbox title 변경방법

오늘은 실험실에서 mmdetection 툴박스에서 제공하는 Mask R-CNN으로 추론하던 중 추론결과 표시되는 bbox title을 변경하는 task가 주어졌다. 위 문제를 해결하는 방법을 정리해보려 한다. 원본코드를 이용한 추론결과는 위와 같다. mmdetection Mask R-CNN코드는 다음 순서에 따라 동작한다. 1. config, checkpoint file을 불러오기 2. init_detector를 이용해 detector model 생성 3. 추론하고자 하는 image를 불러들여 inference_detector(model, image_name) 함수를 이용해 추론 4. show_result 함수를 이용해 추론된 결과를 원본 이미지 위에 그려주고 저장 # config 파일을 설정하고, ma..

[2022 매카톤] Video Abnormal Detection Tutorial

1. 데이터셋 수집(동영상 촬영) AI Hub의 이상행동 탐지 데이터셋 활용예정 https://aihub.or.kr/aidata/139 이상행동 CCTV 영상 12가지의 이상행동(폭행, 싸움, 절도, 기물파손, 실신, 배회, 침입, 투기, 강도, 데이트 폭력 및 추행, 납치, 주취행동), 총 700시간(8400컷) 비디오 데이터셋 촬영 및 구축한 영상 데이터 제공 aihub.or.kr 2. video file 프레임 분할 https://n2infotech.co.kr/193 위 블로그에 나와있는대로 VLC Media Player 프로그램을 이용하여 프레임을 분할한다. 3. 데이터 라벨링 https://github.com/tzutalin/labelImg GitHub - tzutalin/labelImg: 🖍️..

[2022 매카톤] Face Detection+Blur Tutorial

1. 데이터셋 수집(동영상 촬영) 인터넷에 공개된 오픈소스 데이터셋 대부분은 머리 전체를 face로 놓고 데이터셋을 구성하였기 때문에 우리의 목적과 다소 차이가 있다. 따라서 이번 매카톤 프로젝트에서는 한국인의 얼굴 데이터를 직접 동영상 촬영한 뒤 프레임 분할하여 face datset을 구성할 예정이다. 2. video file 프레임 분할 https://n2infotech.co.kr/193 위 블로그에 나와있는대로 VLC Media Player 프로그램을 이용하여 프레임을 분할한다. 3. 데이터 라벨링 https://github.com/tzutalin/labelImg GitHub - tzutalin/labelImg: 🖍️ LabelImg is a graphical image annotation tool..

[2022 매카톤] Dron Tracker Tutorial

1. 데이터셋 다운로드(video file) https://github.com/DroneDetectionThesis/Drone-detection-dataset GitHub - DroneDetectionThesis/Drone-detection-dataset: Dataset containing IR, visible and audio data to be used to train drone d Dataset containing IR, visible and audio data to be used to train drone detection systems. - GitHub - DroneDetectionThesis/Drone-detection-dataset: Dataset containing IR, visible a..

[mmdetection] 초기 환경세팅 정보

기본환경 OS: ubuntu 18.04 cuda: 10.2 cudnn 8.3.0 for cuda-10.2 python: 3.7.13 pytorch : 1.8.1 for cuda 10.2 mmdetection 설치 pip install mmcv-full -f https://download.openmmlab.com/mmcv/dist/cu102/torch1.8.1/index.html pip install mmdet APOLLO Workstation python : 3.8.13 pytorch: 1.10.0 cuda: 11.3 cudnn: 8.2.1 for cuda 11.x mmdet: 2.25.0 mmcv-full: 1.47 + git이 설치되어 있지 않으면 mim install로 mmdet 설치 불가능하다

[window10] 파이썬 콘솔에 표시되는 텍스트 색 변경

오늘은 파이썬 코드상에서 콘솔에 표시되는 텍스트의 색을 변경하는 방법을 정리하려한다. 최종목표 콘솔창에 표시되는 텍스트색을 변경하는 것은 따로 파이썬 라이브러리로 하는 것은 아니고 ANSI escape code를 사용하는 것이다. 순서는 다음과 같다. 1. Escape 코드 작성 # 글자색 정의 class Colors: RED = '\033[31m' GREEN = '\033[32m' YELLOW = '\033[33m' BLUE = '\033[34m' MAGENTA = '\033[35m' CYAN = '\033[36m' WHITE = '\033[37m' RESET = '\033[0m' # 글자 색 리스트로 저장 color_list = [Colors.RED, Colors.GREEN, Colors.YELLOW..

카테고리 없음 2022.04.28

[Depth camera] 이론

우리가 아는 Depth camera에는 크게 3가지 방식이 있다. 첫째, Streo 방식 둘째, ToF 방식 셋째, Lidar 방식 오늘은 위 세가지 방식들의 원리 및 장단점에 대해 공부하고 정리하려한다. 정리에 앞서 카메라 좌표계 시스템을 먼저 정의해야 할 것 같아서 정리하고 넘어가려 한다. 영상 geometry는 카메라 캘리브레이션, 스테레오 매칭 등 다양한 분야에 있어서 가장 기본이 되는 요소로서 geometry에 대한 이해 없이는 카메라의 동작방식을 제대로 이해할 수 없다. 0. 좌표계 영상 geometry에는 크게 4가지 좌표계가 존재한다. - 월드좌표계 - 카메라좌표계 - 정규좌표계 - 픽셀좌표계 월드좌표계와 카메라 좌표계는 3차원 좌표계이고 정규좌표계와 픽셀좌표계는 2차원 좌표계이다. 0.1..

카메라/기하학 2022.04.25

[Detection] Yolov5 custom dataset 학습 및 추론방법

2022년 5월 24일 기준 작성된 글입니다. 수정사항이 있으면 댓글로 말씀 부탁드립니다. 실행환경 os: window10 python: 3.8 pytorch: 1.10.0 cuda: 11.3 cudnn: 8.2.1 for cuda 11.x 1. 가상환경 생성 #가상환경 생성 conda create -n yolov5 python=3.8 #가상환경 실행 conda activate yolov5 2. pytorch 설치 cuda 11.3에 맞는 pytorch 설치 # CUDA 11.3 conda install pytorch==1.10.0 torchvision==0.11.0 torchaudio==0.10.0 cudatoolkit=11.3 -c pytorch -c conda-forge 3. pytorch cuda..