Skip to content

A tool to take periodic webcam photos, and filter humanless ones

License

Notifications You must be signed in to change notification settings

Wheest/desk-cheese

Repository files navigation


Logo

Desk Cheese

A tool to take periodic webcam photos, and filter humanless ones

About

I thought it would be interesting to get a timelapse of myself as I wrote my thesis, so I wrote this tool to do just that. It has a bash script (take_photo.sh) to take a photograph using the webcam, and saves it as a timestamped image. The script should be run as a cronjob, with an example of how to do that given in the script itself.

Then, there is then a Python script that runs the YOLOv3 object detection model on the images, to see which ones contain a human. The script saves lists of images that it thinks contains humans and those it doesn't, and caches the inference results so we don't need to repeat.

The final script generate_animated_gif.sh takes the images and turns them into an animated GIF. Alternatively, you can run generate_mp4.sh to make a video, which also optionally add an audio file.

Why the name?

The tool is intended to run while one is working at one's desk, and "cheese" is something people say in English to smile when they are being photographed.

Usage

As well as the Python dependencies tqdm opencv-python numpy, you also need the imagemagick and fswebcam packages.

Edit the take_photo.sh script to define where you want to save the files, as well as your working hours. Add the script as a cronjob. From that point on, you can just leave it to do its thing. There's a chance if you have multiple webcams it could take things from the wrong input, so it's worth keeping an eye on that.

Critique

Running YOLOv3 with opencv is not the fastest way to do DNN inference

Correct, but it was the quickest from a development perspective.

The class name you are detecting is person

Yeah, it only detects humans (and perhaps not all humans with equal accuracy). Are all humans persons and are all persons human? That ain't for this tool to decide.

If everything was in Python it would probably be more portable

Yeah, but I asked GPT-4 to generate a couple of GIF generation functions using Pillow and imageio and they just hung. imagemagick does the job for me.

License

Distributed under the MIT License. See LICENSE for more information.

Built With

About

A tool to take periodic webcam photos, and filter humanless ones

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published