Skip to content

marks0kolov/touch-grass

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

a close-up of a hand touching grass

🎉 Approved by NVIDIA!

This is an AI that can determine whether or not are you touching grass. My inspiration when creating this project was a popular [meme](https://knowyourmeme.com/memes/touch-grass) from the internet, where people jokingly tell each other to "go outside and touch grass" when they’re spending too much time on the computer.

Inference

Clone the repository:

git clone https://github.com/marks0kolov/touch_grass.git
cd touch_grass

Install the required packages

pip3 install -r scripts/requirements.txt

Run inference on an image with the provided python script:

python3 scripts/check_touching_grass.py path_to_image.jpg models/grassNet/model.onnx models/poseNet/model.onnx

(don't forget to replace path_to_image with the actual path to image)

The script will load both ONNX models, use both of them to check if the image contains grass and a hand and print the result. To check for only grass or hands run scripts/check_grass.py and scripts/check_hand.py accordingly.

GUI

The AI also has a GUI with a timer that can remind you to touch grass from time to time and check if you've really done it.
You can set a timer:
a screenshot of the site whit a timer setting interface
And then when it finishes the program will ask you to upload a photo of you touching grass:
a screenshot of the site with the header "Time to touch grass!" and a button to upload an image
The AI will then recognize whether or not you uploaded a real photo and not stop the alarm until you uploaded a real photo of you touching grass

a screenshot of the program stating that the uploaded image is incorrect a screenshot of the program stating that the uploaded image is correct
After that the timer setting page will appear again.
To use the interface, you need to run a local server from the root of the project with
python3 -m http.server 1008

and then navigate to http://localhost:1008/gui

Training

Firstly, I took 10.5k images of grass from various datasets on the internet (more info in resources). Then i added an image of a hand to 80% of those images, so that the model also accepts images with hands covering some part of it. I also downloaded 10k of indoor images from the Places365 dataset.
Secondly, using the train.py script from the jetson-inference GitHub repo, I fine‑tuned an Image ResNet‑18 on this dataset for 40 epochs. The best model with an accuracy of 99.82% and a loss of ~0.009 on the validation images was the checkpoint from epoch 36, so i took it as the main model.

Train accuracy graph Train loss graph
Validation accuracy graph Validation loss graph

I also took the original Pose ResNet-18 Hand ONNX model from the jetson-inference repository to detect hands on images.

Resources

About

A neural network that reminds you to touch grass from time to time

Resources

License

Stars

1 star

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors