프로그래밍/python

gaze-tracking 시선추적 python

모랄타이거 2022. 11. 14. 19:01
반응형

 

 

 

GitHub - pperle/gaze-tracking-pipeline: full camera-to-screen gaze tracking pipeline

full camera-to-screen gaze tracking pipeline. Contribute to pperle/gaze-tracking-pipeline development by creating an account on GitHub.

github.com

참고한 git 소스

https://github.com/losemankim/gaze-tracking-pipeline

 

GitHub - losemankim/gaze-tracking-pipeline: full camera-to-screen gaze tracking pipeline

full camera-to-screen gaze tracking pipeline. Contribute to losemankim/gaze-tracking-pipeline development by creating an account on GitHub.

github.com

한글화한 문서입니다.

python version 3.6.8

https://www.python.org/downloads/release/python-368/

 

Python Release Python 3.6.8

The official home of the Python Programming Language

www.python.org

만약 다른버전의 python이 설치되어 있다면 환경변수가 다른 버전의 파이썬일 수 있으니

python 3.6.exe를 찾아 cmd에서 직접 실행하여 가상환경을 만들어준다.

C:/Users/유저이름/AppData/Local/Programs/Python/Python36/python.exe

cmd 명령어

c:/ C:/Users/유저이름/AppData/Local/Programs/Python/Python36/python.exe -m venv 가상환경이름

가상환경이름으로 현재폴더에 가상환경 생성됨

사용한 라이브러리 리스트

absl-py==1.3.0
aiohttp==3.8.3
aiosignal==1.2.0
albumentations==1.1.0
async-timeout==4.0.2
asynctest==0.13.0
attrs==22.1.0
cachetools==4.2.4
certifi==2022.9.24
charset-normalizer==2.0.12
colorama==0.4.5
cycler==0.11.0
dataclasses==0.8
decorator==4.4.2
frozenlist==1.2.0
fsspec==2022.1.0
future==0.18.2
gdk==0.1
google-auth==2.14.1
google-auth-oauthlib==0.4.6
grpcio==1.48.2
h5py==2.10.0
idna==3.4
idna-ssl==1.1.0
imageio==2.15.0
importlib-metadata==4.8.3
importlib-resources==5.4.0
joblib==1.1.1
jsonschema==3.2.0
kiwisolver==1.3.1
Markdown==3.3.7
matplotlib==3.3.3
mediapipe==0.8.3
multidict==5.2.0
networkx==2.5.1
numpy==1.19.3
oauthlib==3.2.2
opencv-python==4.6.0.66
opencv-python-headless==4.6.0.66
packaging==21.3
pandas==1.1.5
Pillow==8.3.2
pip==21.3.1
protobuf==3.19.6
pyasn1==0.4.8
pyasn1-modules==0.2.8
pycairo==1.20.1
pyDeprecate==0.3.1
pyparsing==3.0.9
pyproject-toml==0.0.10
pyrsistent==0.18.0
python-dateutil==2.8.2
pytorch-lightning==1.4.0
pytz==2022.6
PyWavelets==1.1.1
PyYAML==6.0
qudida==0.0.4
requests==2.27.1
requests-oauthlib==1.3.1
rsa==4.9
scikit-image==0.17.2
scikit-learn==0.24.2
scipy==1.5.4
setuptools==59.5.0
six==1.16.0
tensorboard==2.10.1
tensorboard-data-server==0.6.1
tensorboard-plugin-wit==1.8.1
threadpoolctl==3.1.0
tifffile==2020.9.3
toml==0.10.2
torch==1.9.0
torchinfo==1.5.3
torchmetrics==0.6.0
torchvision==0.10.0
tqdm==4.61.2
typing_extensions==4.1.1
urllib3==1.26.12
Werkzeug==2.0.3
wheel==0.37.1
yarl==1.7.2
zipp==3.6.0

복사후 txt파일로 저장후 pip install -r 파일이름.txt 설치

 

https://moraltiger.tistory.com/55

 

window에서 mediapipe(미디어파이프)사용하기

윈도우 환경에서 미디어파이프를 사용하기위해서는 아래의것들이 필요합니다. 1.MSYS2 2.python (ps. 3.7버전까지 지원함 3.Visual C++ 빌드 도구 2019 및 WinSDK 설치 4.Bazel 또는 Bazelisk 5.OpenCV 6.protoc https://ww

moraltiger.tistory.com

미디어파이프 오류시 게시물 참조

 

https://github.com/pperle/gaze-tracking-pipeline.git

 

GitHub - pperle/gaze-tracking-pipeline: full camera-to-screen gaze tracking pipeline

full camera-to-screen gaze tracking pipeline. Contribute to pperle/gaze-tracking-pipeline development by creating an account on GitHub.

github.com

git clone으로 프로젝트 clone 가상환경폴더에 복사하면 편함

camera_calibration.py로 웹캠을 보정해주어야함 ->

체스판무늬의 종이등을 이용해 동영상촬영후 프레임단위로 나눠 카메라보정

(필요한 프로그램 ffmpeg 동영상을 프레임단위로 잘라주는 프로그램)

 

이후 https://drive.google.com/drive/folders/1-_bOyMgAQmnwRGfQ4QIQk7hrin0Mexch

 

pretrained_models - Google Drive

이 폴더에 파일이 없습니다.이 폴더에 파일을 추가하려면 로그인하세요.

drive.google.com

모델을 다운로드후 main.py가 있는 폴더에 훈련데이터를 넣고 

 

 

python main.py --calibration_matrix_path=./calibration_matrix.yaml --model_path=./p14.ckpt --monitor_mm=244,356 --monitor_pixels=1920,1080
 

하나하나 설명하자면 

--calibration_matrix_path=./calibration_matrix.yaml 

보정데이터 지정

 --model_path=./p14.ckpt

모델데이터 14번으로 지정 0~14 맘대로 하여도 무방

window로 실행할 경우 모니터의 크기를 알아올 수 없음 직접입력

--monitor_mm=244,356 

모니터의 실제 mm 크기

(본인은 LG그램 15인치 사용중)

--monitor_pixels=1920,1080

해상도 설정

 

실행결과 그러나 위,아래는 잘인식하나 오른쪽 왼쪽은 약간 벙찌는 걸로 보아 보정데이터 혹은 모델데이터를 조금 손보아야할것같다.

ps.실제 눈의 움직임정도와 시선의 정도는 사람마다 다를 수있따.

반응형