/Psycho-Detector

2023-2 Medical Image Processing Project : Short-term Muscular Tic-Patients Detector : Half-Automated Extracted Model based Algorithms using Google MediaPipe to Analysis Tic Region of Interest

Primary LanguageJupyter NotebookOtherNOASSERTION

Psycho-Detector ๐Ÿง 

Short-term Muscular Tic-Patients Detector : Automated Tic Detector Algorithm based model using Google MediaPipe, CNN Classifier to Analysis Tic Region of Interest

Project nickname : Psycho Detector ์ž์„ธํ•œ๋‚ด์šฉ

Member

๊ตฌ๋ถ„ ์ด๋ฆ„ ์—ญํ• 
S/W:https://github.com/dablro12 ์ตœ๋Œ€ํ˜„ ํ”„๋กœ์ ํŠธ ์ด๊ด„, ์•Œ๊ณ ๋ฆฌ์ฆ˜ ๊ฐœ๋ฐœ ๋ฐ ๋ชจ๋ธ ํ•™์Šต ๋ฐ ์ ์šฉ, ๋ฐ์ดํ„ฐ ์ˆ˜์ง‘ ๋ฐ ๋ถ„์„
S/W:https://github.com/yeongjinjeong ์ •์˜์ง„ Streamlit ํŒŒ์ด์ฌ์›น์•ฑ ๊ตฌํ˜„ ๋ฐ PPT ์ œ์ž‘
S/W ์ด์ƒ๊ฒฝ ๋ฐ์ดํ„ฐ ์ˆ˜์ง‘ ๋ฐ ๋ถ„์„
H/W ์ด์ˆ˜ํ•˜ ๋ฐ์ดํ„ฐ ์ˆ˜์ง‘ ๋ฐ ๋ผ์ฆˆ๋ฒ ๋ฆฌํŒŒ์ด ๊ตฌ๋™

Project execution period : 2023.09~2023.12

Project Hosting : ์ตœ๋Œ€ํ˜„


0. Service description

Orginal Video(Input) / Tic Detector Video(Output)

original test_file ezgif com-video-to-gif

Streamlit Page

1 2

Description & Purpose

์กธ์Œ๊ฐ์ง€ ์‹œ์Šคํ…œ์˜ ํ–‰๋™ ํŒจํ„ด ์ธ์‹ ํ™œ์šฉํ•˜์—ฌ 1. ์‹ฌ๋ฆฌ์žฅ์• (๋šœ๋ › ์ฆํ›„๊ตฐ ๋ฐ ADHD ์ฆํ›„๊ตฐ) ๊ฐ์ง€ ๋ฐ 2. ์ˆ˜์—… ์ค‘ ๊ฐ•์˜ ์ง‘์ค‘๋ ฅ ํ–ฅ์ƒ ๋ฐ ๊ฐ•์˜ ๊ฒฝํ—˜ ๊ฐœ์„  ๋ฐฉํ–ฅ์„ ์ œ์‹œํ•œ๋‹ค.

  • ํ•™๋ น๊ธฐ ์•„๋™์„ ๋Œ€์ƒ์œผ๋กœ ๋งค์šฐ ํ”ํ•˜๊ฒŒ ๋ฐœ์ƒํ•˜๋Š” โ€˜ํ‹ฑโ€™ ํŒจํ„ด์„ ๊ฐ์ง€ํ•˜์—ฌ ์ถ”ํ›„์— ๋ฐœ์ƒํ•  ์ˆ˜ ์žˆ๋Š” ๋šœ๋ ›์ฆํ›„๊ตฐ์ด๋‚˜ ADHD์ฆํ›„๊ตฐ๊ณผ ๊ฐ™์€ ์‹ฌ๋ฆฌ ์žฅ์• ์— ๋Œ€ํ•˜์—ฌ ์ดˆ๊ธฐ์— ์ ์ ˆํ•œ ์กฐ์น˜๊ฐ€ ์ทจํ•ด์งˆ ์ˆ˜ ์žˆ๋„๋ก ํ•œ๋‹ค.
  • ์‚ฌ์šฉ์ž๊ฐ€ ์ง‘์ค‘๋ ฅ์„ ์žƒ๊ณ  ํ”ผ๋กœํ•˜๊ฑฐ๋‚˜ ์ŠคํŠธ๋ ˆ์Šค๋ฅผ ๋ฐ›๋Š” ๊ฒฝ์šฐ, ํœด์‹์„ ์ œ์•ˆํ•˜๋Š” ๋ฉ”์‹œ์ง€๋‚˜ ์Œ์•… ์„ ํƒ ๋“ฑ์˜ ์ง‘์ค‘๋ ฅ ํ–ฅ์ƒ ๋ฐฉ์•ˆ ๋ฐ ํ•™์Šต ํ‰๊ฐ€ ๊ฒฐ๊ณผ๋ฅผ ์ œ์‹œํ•ด ์‚ฌ์šฉ์ž์˜ ํ•™์Šต ๊ฐœ์„  ๋ฐฉ์•ˆ์„ ์ œ๊ณตํ•œ๋‹ค.
  • ์‚ฌ์šฉ์ž๊ฐ€ ๋ฌด์˜์‹์ ์œผ๋กœ ๋‚˜ํƒ€๋‚ด๋Š” ๊ฐ•์˜ ๋‚ด์šฉ์˜ ์ดํ•ด์™€ ๊ด€๋ จ๋œ ํ–‰๋™(๊ณ ๊ฐœ ๋„๋•์ž„, ์–ผ๊ตด ์ฐก๊ทธ๋ฆผ, ํ‘œ์ • ๋“ฑ)์„ ํŒŒ์•…ํ•˜์—ฌ ๊ฐ•์˜์ž์˜ ์ง€๋„ ๊ฐœ์„ ์— ๋„์›€์„ ์ค€๋‹ค.

แ„‰แ…ณแ„แ…ณแ„…แ…ตแ†ซแ„‰แ…ฃแ†บ 2023-11-30 แ„‹แ…ฉแ„’แ…ฎ 4 58 22 Pipeline

1. function list

๊ตฌ๋ถ„ ๊ธฐ๋Šฅ ๊ตฌํ˜„
S/W ์–ผ๊ตด ๋ฉ”์‰ฌ ๋ฐ์ดํ„ฐ ์ƒ์„ฑ ๋ชจ๋ธ Mediapipe Face Landmark Detection with google
S/W ๊ฐ๋„ ์ธก์ • ๋ฐ์ดํ„ฐ ๋ณ€ํ™˜ ๋ฐ ๋ถ„์„ OpenCV/Numpy/Pandas/Matplotlib
S/W Visualization Streamlit
H/W ์ž…๋ ฅ ๋ชจ๋“ˆ Iphone 12 pro

2. detailed function

Software

**- ๋งˆ์Šคํฌ ๋ฐ Featrue Abstract **

  • face_outline_masking : ์–ผ๊ตด ์™ธ๊ณฝ ๋งˆ์Šคํฌ ์ƒ์„ฑ ํ•จ์ˆ˜
  • hanging_cnt_v1 : ๋จธ๋ฆฌ Hanging Detection ๋ถ€ํ˜ธํ™” ์ด์šฉ ํ•จ์ˆ˜
  • hanging_cnt_v2 : ๋จธ๋ฆฌ Hanging Detection ๊ทธ๋ฃนํ™” ์ด์šฉ ํ•จ์ˆ˜
  • is_eye_closed : ์ข…ํšก๋น„๋ฅผ ์ด์šฉํ•œ ๋ˆˆ ๊ฐ๊ธฐ ํšŸ์ˆ˜ ์ธก์ • ํ•จ์ˆ˜
  • face_emotion_detector : ํ‘œ์ • ๊ฐ์ง€ ๋”ฅ๋Ÿฌ๋‹ ๋ชจ๋ธ inference ํ•จ์ˆ˜
  • save_area : Mesh data ๋ถ€ํ”ผ ์ €์žฅ ํ•จ์ˆ˜
  • z_score_norm : Z_score Normalization ํ•จ์ˆ˜

**- Scoring : Feature Scoring **

  • total_weight_score : ์ตœ์ข… ์Šค์ฝ”์–ด ํ•จ์ˆ˜
  • hanging_face_score : ๋จธ๋ฆฌ Hanging Scoring ํ•จ์ˆ˜
  • unpair_eye_blink_score : ๋ˆˆ ์ฐก๊ทธ๋ฆผ ๊ฐ์ง€ ๋ฐ Scoring ํ•จ์ˆ˜
  • blink_equal_score : ๋ˆˆ ๊ฐ๊ธฐ Scoring ํ•จ์ˆ˜
  • emotion_scoring : ํ‘œ์ • ๊ฐ์ง€ Scoring ํ•จ์ˆ˜

**- Analysis : ์–ผ๊ตด ๋‚ด ์กด์žฌํ•˜๋Š” ํŠน์ง•(๋ˆˆ, ์–ผ๊ตด ๋“ฑ ํŠน์ • ๋ถ€์œ„์˜ ์˜์—ญ๊ณผ ์ขŒํ‘œ(x,y,z) **

  • save_np : ํ”„๋ ˆ์ž„๋ณ„ ๋žœ๋“œ๋งˆํฌ ์ €์žฅ ํ•จ์ˆ˜
  • landmark_analysis_plot : ๋žœ๋“œ๋งˆํฌ ๋ถ„์„ ํ•จ์ˆ˜
  • calculate_triangle_area : ๋ฉ”์‰ฌ ๋ฐ์ดํ„ฐ ๋ฉด์  ๊ณ„์‚ฐ ํ•จ์ˆ˜
  • cal_area : ๋ฉ”์‰ฌ ๋ฐ์ดํ„ฐ ๋ชจ๋“  ๋žœ๋“œ๋งˆํฌ ๋ฉด์  ๊ณ„์‚ฐ ํ•จ์ˆ˜
  • area_analysis : ํ”„๋ ˆ์ž„๋ณ„ ๋ฉด์  ๋ถ„์„ ํ•จ์ˆ˜
  • blink_z_score_norm : ๋ˆˆ ๊ฐ๊ธฐ์— ๋Œ€ํ•œ ์ ์ • Threshold ์„ ์ • ๋ถ„์„ ํ•จ์ˆ˜
  • box_plot_seperate : ํ…Œ์ŠคํŠธ ์…‹ ๊ฒ€์ฆ ํ•จ์ˆ˜
  • ์‹œ๊ฐํ™” : Streamlit๋ฅผ ์ด์šฉํ•˜์—ฌ ์›นํŽ˜์ด์ง€๋กœ ๊ตฌํ˜„๊ฐ€๋Šฅํ•œ ์›น์„œ๋น„์Šค

Environment

Python Version 3.8.18 Linux Ubuntu 20.0.2

Prerequisite

impor cv2

import mediapipe as mp

import os

import numpy as np

import pandas as pd

import matplotlib.pyplot as plt

import seaborn as sns

from mpl_toolkits.mplot3d import Axes3D

from mediapipe import solutions

from mediapipe.framework.formats import landmark_pb2

from pywt import wavedec

from imutils.video import VideoStream

import f_detector

import imutils

Files

f_detector.py Face Detector code file

config.py f_detector.py config file

main.py Main code file by using python language

main_for_human.ipynb human detect updating main code file

streamlit.py Web application to visualization our project

Usage Pipeline

main.ipynb

Usage Solution

  1. Make a Virtual ENV, Download requirements.txt and pip requirements.txt file
  2. Download test, model folder and streamlit.py file
  3. Execute terminal on your download path, streamlit run streamlit.py