手部21个关键点检测,二维手势姿态,手势识别,pytorch,handpose

Overview

HandPose X

手势 21 个关键点检测 , handpose

重要更新

添加 onnx 模块,预训练模型中有转好的resnet50-onnx模型,注意:目前不支持rexnetv1

"dpcas" 项目地址:https://codechina.csdn.net/EricLee/dpcas

项目 - 首发布地址

https://codechina.csdn.net/EricLee/handpose_x

项目Wiki

注意:项目的相关资料信息或是更新状态会同步到项目Wiki,以便更好的对该项目进行维护和不断发展,谢谢大家对该项目的关注!

项目介绍

注意:该项目不包括手部检测部分,手部检测项目地址:https://codechina.csdn.net/EricLee/yolo_v3
该项目是对手的21个关键点进行检测,示例如下 :

  • 图片示例:
    image
  • 视频示例:
    video

Demo小样

  • 示例1 - 按键操作
    因为考虑到目前没有三维姿态不好识别按键按下三维动作,所以目前采用二维方式。
    该示例的原理:通过简单的IOU跟踪,对二维目标如手的边界框或是特定手指的较长时间位置稳定性判断确定触发按键动作的时刻,用特定指尖的二维坐标确定触发位置。
    (注意:目前示例并未添加到工程,后期整理后会进行发布,只是一个样例,同时希望同学们自己尝试写自己基于该项目的小应用。)
    keyboard

  • 示例2 - 手势交互:指定区域物体识别
    该示例的出发点是希望通过手势指定用户想要识别的物体。那么就要选中物体的准确边界框才能达到理想识别效果。如果待识别目标边界框太大会引入背景干扰,太小又会时目标特征不完全。所以希望通过手势指定较准确的目标边界框。因为边界框涉及左上、右下两个二维坐标,所以通过两只手的特定指尖来确定。且触发逻辑与示例1相同。
    该示例的原理:通过简单的IOU跟踪,对二维目标如手的边界框或是特定手指的较长时间位置稳定性判断确定触发按键动作的时刻,用特定指尖的二维坐标确定触发位置。
    (注意:目前示例并未添加到工程,后期整理后会进行发布,只是一个样例,同时希望同学们自己尝试写自己基于该项目的小应用。)
    该示例依赖于另外一个物体识别分类项目。

keyboard

  • 以下是对书上狗的图片进行分类识别的样例,同学们可以根据自己对应的物体识别分类需求替换对应的分类识别模型即可。

recoobj_book

该物体识别分类项目的地址为: https://codechina.csdn.net/EricLee/classification

  • 示例3 - 静态手势
    通过手关键点的二维角度约束关系定义静态手势。
    示例中手势包括:fist five gun love one six three thumbup yeah
    目前该示例由于静态手势数据集的限制,目前用手骨骼的二维角度约束定义静态手势,原理如下图,计算向量AC和DE的角度,它们之间的角度大于某一个角度阈值(经验值)定义为弯曲,小于摸一个阈值(经验值)为伸直。
    注:这种静态手势识别的方法具有局限性,有条件还是通过模型训练的方法进行静态手势识别。

gs

视频示例如下图:
gesture

  • 示例4 - 静态手势交互(识别)
    通过手关键点的二维角度约束关系定义静态手势。
    该项目通过手势操作选择分类识别区域或是ocr识别区域,送入分类识别网络或是第三方web识别服务,亦或是检索数据库等应用。

    原理:通过二维约束获得静态手势,该示例是通过 食指伸直(one) 和 握拳(fist)分别代表范围选择和清空选择区域。
    建议最好还是通过分类模型做静态手势识别鲁棒和准确高,目前局限于静态手势训练集的问题用二维约束关系定义静态手势替代。

ocrreco

项目配置

1、软件

  • 作者开发环境:
  • Python 3.7
  • PyTorch >= 1.5.1
  • opencv-python

2、硬件

  • 普通USB彩色(RGB)网络摄像头

数据集

该数据集包括网络图片及数据集< >筛选动作重复度低的部分图片,进行制作(如有侵权请联系删除),共49062个样本。
< >数据集,其官网地址 http://www.rovit.ua.es/dataset/mhpdataset/
感谢《Large-scale Multiview 3D Hand Pose Dataset》数据集贡献者:Francisco Gomez-Donoso, Sergio Orts-Escolano, and Miguel Cazorla. "Large-scale Multiview 3D Hand Pose Dataset". ArXiv e-prints 1707.03742, July 2017.

模型

1、目前支持的模型 (backbone)

  • resnet18 & resnet34 & resnet50 & resnet101
  • squeezenet1_0 & squeezenet1_1
  • ShuffleNet & ShuffleNetV2
  • MobileNetV2
  • rexnetv1
  • shufflenet_v2_x1_5 ,shufflenet_v2_x1_0 , shufflenet_v2_x2_0 (torchvision 版本)

2、预训练模型

项目使用方法

模型训练

  • 根目录下运行命令: python train.py (注意脚本内相关参数配置 )

模型推理

  • 根目录下运行命令: python inference.py (注意脚本内相关参数配置 )

onnx使用

  • step1: 设定相关配置包括模型类型和模型参数路径,根目录下运行命令: python model2onnx.py (注意脚本内相关参数配置 )
  • step2: 设定onnx模型路径,根目录下运行命令: python onnx_inference.py (注意脚本内相关参数配置 )
  • 建议

检测手bbox后,进行以下的预处理,crop手图片送入手关键点模型进行推理,   
可以参考 hand_data_iter/datasets.py,数据增强的样本预处理代码部分,   
关键代码如下:     
  img 为原图  ,np为numpy  
  x_min,y_min,x_max,y_max,score = bbox  
  w_ = max(abs(x_max-x_min),abs(y_max-y_min))  

  w_ = w_*1.1  

  x_mid = (x_max+x_min)/2  
  y_mid = (y_max+y_min)/2  

  x1,y1,x2,y2 = int(x_mid-w_/2),int(y_mid-w_/2),int(x_mid+w_/2),int(y_mid+w_/2)  

  x1 = np.clip(x1,0,img.shape[1]-1)  
  x2 = np.clip(x2,0,img.shape[1]-1)  

  y1 = np.clip(y1,0,img.shape[0]-1)  
  y2 = np.clip(y2,0,img.shape[0]-1)  

联系方式 (Contact)

特别感谢

You might also like...
A PyTorch implementation of the paper Mixup: Beyond Empirical Risk Minimization in PyTorch
A PyTorch implementation of the paper Mixup: Beyond Empirical Risk Minimization in PyTorch

Mixup: Beyond Empirical Risk Minimization in PyTorch This is an unofficial PyTorch implementation of mixup: Beyond Empirical Risk Minimization. The co

A pytorch implementation of  Pytorch-Sketch-RNN
A pytorch implementation of Pytorch-Sketch-RNN

Pytorch-Sketch-RNN A pytorch implementation of https://arxiv.org/abs/1704.03477 In order to draw other things than cats, you will find more drawing da

Pytorch-version BERT-flow: One can apply BERT-flow to any PLM within Pytorch framework.

Pytorch-version BERT-flow: One can apply BERT-flow to any PLM within Pytorch framework.

PyTorch implementation of Advantage async actor-critic Algorithms (A3C) in PyTorch
PyTorch implementation of Advantage async actor-critic Algorithms (A3C) in PyTorch

Advantage async actor-critic Algorithms (A3C) in PyTorch @inproceedings{mnih2016asynchronous, title={Asynchronous methods for deep reinforcement lea

A lightweight wrapper for PyTorch that provides a simple declarative API for context switching between devices, distributed modes, mixed-precision, and PyTorch extensions.
A lightweight wrapper for PyTorch that provides a simple declarative API for context switching between devices, distributed modes, mixed-precision, and PyTorch extensions.

A lightweight wrapper for PyTorch that provides a simple declarative API for context switching between devices, distributed modes, mixed-precision, and PyTorch extensions.

A PyTorch repo for data loading and utilities to be shared by the PyTorch domain libraries.

A PyTorch repo for data loading and utilities to be shared by the PyTorch domain libraries.

Unofficial PyTorch implementation of DeepMind's Perceiver IO with PyTorch Lightning scripts for distributed training

Unofficial PyTorch implementation of DeepMind's Perceiver IO with PyTorch Lightning scripts for distributed training

Template repository to build PyTorch projects from source on any version of PyTorch/CUDA/cuDNN.

Template repository to build PyTorch projects from source on any version of PyTorch/CUDA/cuDNN.

Amazon Forest Computer Vision: Satellite Image tagging code using PyTorch / Keras with lots of PyTorch tricks
Amazon Forest Computer Vision: Satellite Image tagging code using PyTorch / Keras with lots of PyTorch tricks

Amazon Forest Computer Vision Satellite Image tagging code using PyTorch / Keras Here is a sample of images we had to work with Source: https://www.ka

A bunch of random PyTorch models using PyTorch's C++ frontend
A bunch of random PyTorch models using PyTorch's C++ frontend

PyTorch Deep Learning Models using the C++ frontend Gettting started Clone the repo 1. https://github.com/mrdvince/pytorchcpp 2. cd fashionmnist or

PyTorch Autoencoders - Implementing a Variational Autoencoder (VAE) Series in Pytorch.

PyTorch Autoencoders Implementing a Variational Autoencoder (VAE) Series in Pytorch. Inspired by this repository Model List check model paper conferen

PyTorch framework A simple and complete framework for PyTorch, providing a variety of data loading and simple task solutions that are easy to extend and migrate

PyTorch framework A simple and complete framework for PyTorch, providing a variety of data loading and simple task solutions that are easy to extend and migrate

PyTorch-LIT is the Lite Inference Toolkit (LIT) for PyTorch which focuses on easy and fast inference of large models on end-devices.

PyTorch-LIT PyTorch-LIT is the Lite Inference Toolkit (LIT) for PyTorch which focuses on easy and fast inference of large models on end-devices. With

A general framework for deep learning experiments under PyTorch based on pytorch-lightning

torchx Torchx is a general framework for deep learning experiments under PyTorch based on pytorch-lightning. TODO list gan-like training wrapper text

A PyTorch Extension: Tools for easy mixed precision and distributed training in Pytorch

Introduction This is a Python package available on PyPI for NVIDIA-maintained utilities to streamline mixed precision and distributed training in Pyto

Pytorch-diffusion - A basic PyTorch implementation of 'Denoising Diffusion Probabilistic Models'
Pytorch-diffusion - A basic PyTorch implementation of 'Denoising Diffusion Probabilistic Models'

PyTorch implementation of 'Denoising Diffusion Probabilistic Models' This reposi

RetinaNet-PyTorch - A RetinaNet Pytorch Implementation on remote sensing images and has the similar mAP result with RetinaNet in MMdetection
ALBERT-pytorch-implementation - ALBERT pytorch implementation

ALBERT-pytorch-implementation developing... 모델의 개념이해를 돕기 위한 구현물로 현재 변수명을 상세히 적었고

RETRO-pytorch - Implementation of RETRO, Deepmind's Retrieval based Attention net, in Pytorch
RETRO-pytorch - Implementation of RETRO, Deepmind's Retrieval based Attention net, in Pytorch

RETRO - Pytorch (wip) Implementation of RETRO, Deepmind's Retrieval based Attent

Comments
  • multi-face keypoints

    multi-face keypoints

    hello author, I check your work at https://gitcode.net/EricLee/facial_landmark

    I have trained a simple model using FCN for face keypoint using heatmap regression. Can you please tell me how we can get heatmaps of muliple faces in the bottom-up approach. My current model takes input of 96x96x1 image and gives 96x96x15 size heatmaps for 15 keypoints. I trained my model using kaggle dataset consisting of images with single face pre cropped to 96x96.

    I want to perform multiface keypoint heatmaps. Do i need the dataset with multiple faces? and do I need bouding box information or mask information too?

    Please give me your advice thank you

    opened by soans1994 0
Owner
Eric.Lee
Eric.Lee
Generic template to bootstrap your PyTorch project with PyTorch Lightning, Hydra, W&B, and DVC.

NN Template Generic template to bootstrap your PyTorch project. Click on Use this Template and avoid writing boilerplate code for: PyTorch Lightning,

Luca Moschella 520 Dec 30, 2022
A PyTorch Extension: Tools for easy mixed precision and distributed training in Pytorch

This repository holds NVIDIA-maintained utilities to streamline mixed precision and distributed training in Pytorch. Some of the code here will be included in upstream Pytorch eventually. The intention of Apex is to make up-to-date utilities available to users as quickly as possible.

NVIDIA Corporation 6.9k Jan 3, 2023
A PyTorch Extension: Tools for easy mixed precision and distributed training in Pytorch

Introduction This repository holds NVIDIA-maintained utilities to streamline mixed precision and distributed training in Pytorch. Some of the code her

NVIDIA Corporation 6.9k Dec 28, 2022
Tez is a super-simple and lightweight Trainer for PyTorch. It also comes with many utils that you can use to tackle over 90% of deep learning projects in PyTorch.

Tez: a simple pytorch trainer NOTE: Currently, we are not accepting any pull requests! All PRs will be closed. If you want a feature or something does

abhishek thakur 1.1k Jan 4, 2023
Mirco Ravanelli 2.3k Dec 27, 2022
Objective of the repository is to learn and build machine learning models using Pytorch. 30DaysofML Using Pytorch

30 Days Of Machine Learning Using Pytorch Objective of the repository is to learn and build machine learning models using Pytorch. List of Algorithms

Mayur 119 Nov 24, 2022
Pretrained SOTA Deep Learning models, callbacks and more for research and production with PyTorch Lightning and PyTorch

Pretrained SOTA Deep Learning models, callbacks and more for research and production with PyTorch Lightning and PyTorch

Pytorch Lightning 1.4k Jan 1, 2023
Amazon Forest Computer Vision: Satellite Image tagging code using PyTorch / Keras with lots of PyTorch tricks

Amazon Forest Computer Vision Satellite Image tagging code using PyTorch / Keras Here is a sample of images we had to work with Source: https://www.ka

Mamy Ratsimbazafy 360 Dec 10, 2022
The Incredible PyTorch: a curated list of tutorials, papers, projects, communities and more relating to PyTorch.

This is a curated list of tutorials, projects, libraries, videos, papers, books and anything related to the incredible PyTorch. Feel free to make a pu

Ritchie Ng 9.2k Jan 2, 2023
null 270 Dec 24, 2022