Body-focused repetitive behaviors (BFRBs) can be a problem for many people. These behaviors can range from simple actions like face touching or lip tapping to more complex and damaging behaviors like nail biting or hair pulling.
This tool aims to help individuals manage and reduce these repetitive behaviors by alerting the user whenever their hands are close to their face.
Use my version or host your own.
Synopsis: This script will warn you if your hand is in proximity to your face.
Basic algorithm:
1. Check for face -> warn if missing
2. Save face position f_pos
3. Find and save hand position h_pos
4. Alert if f_pos ~= h_pos
This is for development, use the website if you are a user!
Open a terminal and type:
npm install
npm run theme
npm run dev
Look at http://localhost:8080/ to see your build.
Live updates are possible: Editing anything in src/
and saving these changes should result in an automatic recompilation and refresh of the website.
Theme changes need to be build manually with npm run theme
.
Run npm update
from time to time to keep ahead of the curve for all the dependabot alerts.
Prebuilds are kept out of this repo by design, can't assume they are always in sync.
Just do nothing.
The attached Github Action script creates and updates a branch with all files needed for the deployment.
It's really that simple, can't believe it either.
You do need to link your domain once for each new project:
Yes, you can have multiple CNAMEs pointing to the same URL for YOURNAME.github.io. It's weird but it works, gh-pages manages everything.
Open a terminal and type:
npm run build
Copy ./public/
to your webhost of choice.
I'm also using https://counter.dev/ to track page visits without compromising any privacy with Google Analytics.
I would have liked to use Go for an easy executable of this concept. Face detection is easy to get in any language, but it seems like webcam recordings work better in Python. Python is my go-to for simple tools. Deployment of Python code is a huge mess though. I can live with that for personal usage, but it's not how I envision this tool.
Functionality on a website is just so much better to get this concept to the people that I need to try it. WASM would be great for performant detection logic, but it's not worth the effort atm.
Compiled cross-platform is also great, but my simple example app is fine to have a singular native (but multi-usable) platform for now.
Retrospective: Web is king for portability, can't argue with that. Still shit to develop for though, even with modern helpers, and lacks performance (threading!).
No backend is needed, everything is offline.
This app should be usable via browser though, so we need to have some kind of frontend.
There are a lot of comparisons and rankings, these are my verdicts:
Use a big player if you want a job and a newcomer if you want to play. I'm always down for new experiences, and I already used Vue, see CutSolverFrontend, so a newcomer it is.
A lot of these are great, but have varying use cases. Alpine sounds great, but seems better to future web-portfolio-works. Solid uses Vite, a great build tool, and is even newer, but lacks the community yet. While I don't need Reacts community I depend on examples, which makes the tiny differences between them less important.
SvelteKit seems like a worthy addition for larger apps, but let's keep it simple for now.
Retrospective: Svelte has some quirks, but it's easy to learn and use. Can recommend, even without SvelteKit. Not sure if a framework is actually necessary for such a small app though.
Tensorflow could build a neuronal net to detect more complex patterns, but that would only work for my face. Teachable Machine is a great tool for people that skipped AI in their classes (me included).
Ask some PhD for a cooler model or another AI-driven approach to detect more behaviors.
Generic JS tracking libs:
Handtrack.js has a great demo and seems easy to use, so let's test that one for now.
Retrospective: Handtrack.js is dead in the water. Tracking is flaky and there are a lot of obvious issues without any statement from the main dev. Latest release still feels like early beta, use something better!
As I know now there are no generic UI components in Svelte (or any similar framework), so you need to choose something. Integration with the framework is nice, but optional. It should offer many components to prevent me from building ugly ones though.
Generic CSS frameworks (No JS, looks only):
Full Svelte integration (based on other lists):
My final candidates were Svelte Material UI, Bulma and DaisyUI. Latter ones are more beautiful, the great integration of the former seems better for someone without any background though. SMUI also contains simple Icons, provided by Material UI. Future work could use FontAwesome as the biggest player, Material Design Icons as a large crowd-sourced collection or something Svelte specific like Svelte Icons as an all-in-one importer for everything.
Retrospective: Svelte Material UI definitely isn't production ready yet. It's nice when it works, but there are components missing (footer!), weird hacks for existing ones (standard header) and very little documentation. Icons are limited to original Material UI Icons, missing Github & others, which makes the documentation even less relevant. I would advise against it in favor of something bigger and better documented, maybe even vanilla CSS or some generic framework.
Selfhosting is great if you know what you do, but that's not my case. Luckily there are a few free options for developers.
Summary: There are better comparison lists than mine.
CDN makes high performance usage of a static app much easier than delivering everything yourself. Do this if you want to prevent a hug of death.
Svelte integration seems to be surprisingly simple because you only need to copy the build directory over. Using Github Actions makes sense, I don't want to keep updating everything manually.
Retrospective: GH Pages was obviously easy to integrate and is still a great choice. Cloudflare pages is a close contender because of great edge availability and powerful free offering; making CDNs obsolete. Keep GH Actions for builds though.
Q: Why build this?
A: Ignoring bad habits is a bad habit of mine, let's see if a self-made solution helps.
Q: Privacy?
A: Nothing leaves your computer, everything is offline. Who would pay server costs to capture hours of your face?
Feel free to contact me or make a pull-request if you want to participate. Feedback is very welcome!