버튼을 눌러 속도 조절을 하는 기존 방식과 다르게 자동으로 속도 제어를 하여 휠체어를 탄 사람들의 자동 회전문 사고를 예방합니다.
딥러닝을 통해 휠체어 모델을 학습시키고, 라즈베리 파이의 카메라 모듈을 통해 휠체어와 사람을 인식하고 분류합니다.
휠체어가 인식된다면 속도를 줄이고, 사람이 인식된다면 정상속도로 작동하게 됩니다.
- 박승민, 김연욱, 김현호, 조민호
- yolov5
- 라즈베리 파이 4
- 라즈베리 SSD
- 웹캠
- 아두이노 우노
- 신호등 센서
- L298N
- DC 모터
Roboflow에서 데이터셋을 만들고, Yolov5를 활용하여 학습하고 아이와 휠체어를 탄 사람을 인식한다.
테스트 데이터 출처: https://www.youtube.com/watch?v=Gnr0yn6vmqM
-
Yolov5 설치
$ git clone https://github.com/ultralytics/yolov5
$ pip3 install -r requirements.txt
-
아두이노와 시리얼 통신 설정
import serial import my_influxDB
만약 serial 모듈이 없다면 'pip install serial'을 통해서설치
if __name__ == "__main__": seri = serial.Serial('{SERIAL_PORT}', {BAUDRATE})
yolov5에서 객체를 탐지해 결과 생성한 부분 밑에 시리얼통신하고자하는 코드추가
yolov5 detecy.py의 결과 출력 코드
LOGGER.info(f"{s}{'' if len(det) else '(nodetections), '{dt[1].dt * 1E3:.1f}ms")
if y2 >= y_cnt: if 'wheelchair' in s: seri.write('w'.encode()) detectNo = 1 elif 'person' in s: #child or adult if (y2 - y1) <= 200: # child seri.write('c'.encode()) detectNo = 2 else: # adult seri.write('a'.encode()) detectNo = 3 else: seri.write('n'.encode()) detectNo = 0 y2 = 0 my_influxDB.setInfluxDB(detectNo)
# Write results for *xyxy, conf, cls in reversed(det): if save_txt: # Write to file xywh = (xyxy2xywh(torch.tensor(xyxy).view(1, 4)) / gn).view(-1).tolist() # normalized xywh print(xywh) line = (cls, *xywh, conf) if save_conf else (cls, *xywh) # label format with open(f'{txt_path}.txt', 'a') as f: f.write(('%g ' * len(line)).rstrip() % line + '\n') if save_img or save_crop or view_img: # Add bbox to image c = int(cls) # integer class label = None if hide_labels else (names[c] if hide_conf else f'{names[c]} {conf:.2f}') annotator.box_label(xyxy, label, color=colors(c, True)) # 인식된 객체의 y 좌표값 y1 = xyxy[1] y2 = xyxy[3] if save_crop: save_one_box(xyxy, imc, file=save_dir / 'crops' / names[c] / f'{p.stem}.jpg', BGR=True)
테스트 데이터 출처: https://www.youtube.com/watch?v=XUhPIRwn8a8