--- license: creativeml-openrail-m base_model: runwayml/stable-diffusion-v1-5 tags: - stable-diffusion - stable-diffusion-diffusers - image-to-image - diffusers - controlnet - jax-diffusers-event inference: true widget: - src: >- https://huggingface.co/spaces/vllab/controlnet-hands/resolve/main/example.png prompt: a woman is making an ok sign in front of a painting --- ## Model Description As Stable diffusion and other diffusion models are notoriously poor at generating realistic hands for our project we decided to train a ControlNet model using MediaPipes landmarks in order to generate more realistic hands avoiding common issues such as unrealistic positions and irregular digits. We opted to use the [HAnd Gesture Recognition Image Dataset](https://github.com/hukenovs/hagrid) and [MediaPipe's Hand Landmarker](https://developers.google.com/mediapipe/solutions/vision/hand_landmarker) to train a control net that could potentially be used independently or as an in-painting tool. ## Preprocess To preprocess the data there were three options we considered: - The first was to use Mediapipes built-in draw landmarks function. This was an obvious first choice however we noticed with low training steps that the model couldn't easily distinguish handedness and would often generate the wrong hand for the conditioning image.
Forwarding
Original Image
Routing
Conditioning Image
- To counter this issue we changed the palm landmark colors with the intention to keep the color similar in order to learn that they provide similar information, but different to make the model know which hands were left or right.
Forwarding
Original Image
Routing
Conditioning Image
- The last option was to use MediaPipe Holistic to provide pose face and hand landmarks to the ControlNet. This method was promising in theory, however, the HaGRID dataset was not suitable for this method as the Holistic model performs poorly with partial body and obscurely cropped images. We anecdotally determined that when trained at lower steps the encoded hand model performed better than the standard MediaPipe model due to implied handedness. We theorize that with a larger dataset of more full-body hand and pose classifications, Holistic landmarks will provide the best images in the future however for the moment the hand-encoded model performs best. This repo contain the weight of **ControlNet Hands model** ## Dataset 130k image [Dataset for Hand Encoding Mode](https://huggingface.co/datasets/MakiPan/hagrid250k-blip2) ## Examples These are controlnet weights trained on runwayml/stable-diffusion-v1-5 with new type of conditioning. You can find some example images in the following. prompt: a man in a colorful shirt giving a peace sign in front of a rallying crowd ![images_0)](https://huggingface.co/MakiPan/controlnet-encoded-hands-130k/resolve/main/images_0.png) prompt: a police officer signaling someone to stop in a park ![images_1)](https://huggingface.co/MakiPan/controlnet-encoded-hands-130k/resolve/main/images_1.png)