---
# System prepended metadata

title: Snake game interact with hands

---

# Snake game interact with hands
Base on the idea title above and rebuild my snake game in python and use own pictures to control the navigation of snake

----- example links from Nhan---------------------------
https://github.com/vince19972/TeachableSnake
https://www.youtube.com/watch?v=9iEPzbG-xLE
https://gogul.dev/software/hand-gesture-recognition-p1

# Plan (from 07/06 - 18/06/2021)
**The GOAL: build a simplest game following CDS schedule**
*(Future: integrate with hand detection model and more samples to get better hands navigation)*
## 1. Build app
[ ] Jun 07 - Jun 10: collect pictures and train model for UP, DOWN, LEFT, RIGHT (because sample pitures are around )

[ ] Jun 09 - Jun 11: check predict correction and finetune
[ ] Jun 07 - Jun 11: build webcam detection with vscode: stop at 11/06
[ ] Jun 08 - Jun 12: build snake games with Python with no webcam video detection
[ ] Jun 14: integrate webcam detection and snake games: stop at 14/06
[ ] After Jun 14: pre-optimize (speed and user experience)
[ ] Jun 15: find a way to show both of them on 1 window, if can not find a solution in 1 day, should do it later and keep app with webcam in 2 other places.
[ ] Jun 16: re-collect final pictures and train final model, re-work to increase accuracy for each class.

## 2. SIT (Jun 16)
[ ] Prepare SIT test script (just simplest, try to find something makes program stop)
[ ] Fix and optimize app

## 3. UAT (Jun 17)
[ ] Prepare UAT test script (just simplest, try to find something can improve)
[ ] Optimize user experience

## 4. Prepare presentation (from Jun 18)
[ ] Documents and pictures
[ ] Streamlit

# Difficult
1. Collect sample images: capture myself 4 classes (UP, DOWN, LEFT, RIGHT), when I have more time I will collect pictures from other people.
2. Example github written in Javascript, need transform it to Python
3. pygame.camera doesn't work on Windows platform, so I need to integrate cv2 to open webcam and pygame together

# Update Up-to-NOW
![](https://i.imgur.com/gHOydvi.png)
Can play game with camera but hard to navigate the snake

Trying to use Posenet but it's old (use tf v1)
![](https://i.imgur.com/wEa0fec.png)


# Got from this project
1. Understand more about preprocessing image of google teachable to get the same score
2. How to flip-rotate image input to coordinates (0,0) of pygame library

# TROUBLES
1. App crashes when trying to record video or share screen with my friend when playing game
2. Snake run too fast, maybe decrease moving speed to the half and make the food is bigger