PyTorch MPIIGaze 演示项目教程

PyTorch MPIIGaze 演示项目教程

pytorch_mpiigaze_demoGaze estimation using MPIIGaze and MPIIFaceGaze项目地址:https://gitcode.com/gh_mirrors/py/pytorch_mpiigaze_demo

1. 项目的目录结构及介绍

pytorch_mpiigaze_demo/
├── figures/
├── ptgaze/
│   ├── data/
│   │   ├── configs/
│   │   └── models/
│   ├── __init__.py
│   ├── gaze_estimator.py
│   ├── main.py
│   └── utils.py
├── .gitignore
├── LICENSE
├── MANIFEST.in
├── README.md
├── requirements.txt
└── setup.py
  • figures/: 存放项目相关的图表文件。
  • ptgaze/: 项目的主要代码目录。
    • data/: 存放数据文件,包括配置文件和模型文件。
      • configs/: 配置文件目录。
      • models/: 模型文件目录。
    • __init__.py: 模块初始化文件。
    • gaze_estimator.py: 视线估计的主要逻辑文件。
    • main.py: 项目的启动文件。
    • utils.py: 工具函数文件。
  • .gitignore: Git 忽略文件配置。
  • LICENSE: 项目许可证文件。
  • MANIFEST.in: 打包清单文件。
  • README.md: 项目说明文档。
  • requirements.txt: 项目依赖文件。
  • setup.py: 项目安装文件。

2. 项目的启动文件介绍

项目的启动文件是 ptgaze/main.py。该文件包含了项目的主要执行逻辑,可以通过命令行参数来运行不同的模式(如 mpiigazempiifacegazeeth-xgaze)。

# ptgaze/main.py
import argparse
from ptgaze import GazeEstimator

def main():
    parser = argparse.ArgumentParser(description="Gaze estimation using MPIIGaze and MPIIFaceGaze")
    parser.add_argument("--config", type=str, help="Config file")
    parser.add_argument("--mode", type=str, choices=["mpiigaze", "mpiifacegaze", "eth-xgaze"], help="Mode selection")
    parser.add_argument("--face-detector", type=str, choices=["dlib", "face_alignment_dlib", "face_alignment_sfd", "mediapipe"], help="Face detector selection")
    parser.add_argument("--device", type=str, choices=["cpu", "cuda"], help="Device selection")
    parser.add_argument("--image", type=str, help="Input image file")
    parser.add_argument("--video", type=str, help="Input video file")
    parser.add_argument("--camera", type=int, help="Camera index")
    parser.add_argument("--output-dir", type=str, help="Output directory")
    parser.add_argument("--ext", type=str, choices=["avi", "mp4"], help="Output file extension")
    parser.add_argument("--no-screen", action="store_true", help="Disable screen output")
    parser.add_argument("--debug", action="store_true", help="Enable debug mode")

    args = parser.parse_args()

    gaze_estimator = GazeEstimator(args)
    gaze_estimator.run()

if __name__ == "__main__":
    main()

3. 项目的配置文件介绍

项目的配置文件位于 ptgaze/data/configs/ 目录下。配置文件用于定义项目的各种参数,如模型选择、设备选择、输入输出设置等。

例如,eth-xgaze.yaml 配置文件内容如下:

model:
  name: eth-xgaze
  device: cuda
input:
  type: video
  source: 0
output:
  directory: outputs
  extension: mp4
face_detector:
  type: mediapipe
debug: false
  • model: 定义使用的模型名称和设备。
  • input: 定义输入类型和源(如视频文件或摄像头索引)。
  • output: 定义输出目录和文件扩展名。
  • face_detector: 定义使用的面部检测器类型。
  • debug: 是否启用调试模式。

通过配置文件,用户可以灵活地调整项目的运行参数,

pytorch_mpiigaze_demoGaze estimation using MPIIGaze and MPIIFaceGaze项目地址:https://gitcode.com/gh_mirrors/py/pytorch_mpiigaze_demo

  • 5
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

邓娉靓Melinda

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值