A privacy-first React/Vite app that performs real-time ASL alphabet recognition entirely in the browser using TensorFlow.js and MediaPipe Hands. All video processing happens locallyβhand landmarks are extracted and classified on-device with 98.81% accuracy.
The application uses a landmark-based neural network trained on 151,479 ASL hand gesture samples with 28 classes (A-Z + Space). The model achieves 98.81% validation accuracy and runs at 30+ FPS on modern browsers.
- Real-time Detection: Live ASL alphabet recognition using TensorFlow.js + MediaPipe
- Privacy-First: All processing happens in the browserβno data sent to servers
- High Accuracy: 98.81% validation accuracy on ASL alphabet
- Lightweight: Only 238 KB model size, runs smoothly on most devices
- Accessibility Helpers: Speech synthesis, translation, clipboard copy, and in-app help
- On-Device Processing: Hand landmarks extracted and classified locally
- Data Recorder: Export training data for model improvements
- Node.js 16+ and npm
- Modern web browser with webcam support
- (Optional) GPU for faster inference
# Install dependencies
npm install
# Start development server
npm run devThe dev server runs at http://localhost:8080 by default.
npm run build
npm run previewThe production model is already configured in public/models/alphabet_tfjs/:
model.jsonβ Model architecture and weights manifest (1 KB)group1-shard1of1.binβ Model weights (237 KB)labels.jsonβ 28 class labels (A-Z + Space)
Model Specifications:
- Input: 63 features (21 MediaPipe hand landmarks Γ 3 coordinates, wrist-centered)
- Output: 28 class probabilities
- Architecture: Sequential MLP with 4 dense layers
- Size: ~238 KB (lightweight and fast)
Configuration in src/config.ts:
models: {
alphabet: {
enabled: true,
url: `${import.meta.env.BASE_URL}models/alphabet_tfjs/model.json`,
labelsPath: `${import.meta.env.BASE_URL}models/alphabet_tfjs/labels.json`,
inputShape: [63], // Landmark-based input
useLandmarks: true, // Use MediaPipe landmark extraction
}
}translation: {
enabled: true,
apiEndpoint: "https://libretranslate.com/translate",
apiKey: "", // Add your API key
defaultSourceLanguage: "en",
defaultTargetLanguage: "es",
}The app uses a landmark-based approach for ASL recognition:
- Hand Detection: MediaPipe Hands detects hand in webcam frame
- Landmark Extraction: Extract 21 hand landmarks (x, y, z coordinates)
- Wrist Centering: Normalize by subtracting wrist position from all landmarks
- Classification: Feed 63-feature vector to TensorFlow.js model
- Prediction: Display highest-confidence class (if confidence > 50%)
The app uses landmark-based preprocessing (not image-based):
// 1. Detect hands using MediaPipe
const hands = await detector.estimateHands(video);
// 2. Extract wrist position (landmark 0)
const wrist = hands[0].keypoints[0];
// 3. Create wrist-centered feature vector (63 values)
const landmarks = new Float32Array(63);
for (let i = 0; i < 21; i++) {
const kp = hands[0].keypoints[i];
landmarks[i * 3] = kp.x - wrist.x;
landmarks[i * 3 + 1] = kp.y - wrist.y;
landmarks[i * 3 + 2] = (kp.z || 0) - (wrist.z || 0);
}
// 4. Create tensor and predict
const inputTensor = tf.tensor2d(landmarks, [1, 63]);
const prediction = model.predict(inputTensor);See src/components/LiveDemo.tsx for the full implementation.
To retrain or improve the model:
- Open Training Notebook:
training_setup/sign_language_colab.ipynb - Upload to Google Colab: Requires Kaggle API for dataset access
- Configure Output: Save to Google Drive (
asl_model_output/) - Run Training: Takes ~30-60 minutes on GPU
- Deploy Model: Copy
tfjs_model/contents topublic/models/alphabet_tfjs/
See training_setup/README.md for detailed instructions.
sign-language-translator/
βββ src/
β βββ components/
β β βββ LiveDemo.tsx # Main detection interface
β β βββ DataRecorder.tsx # Data collection tool
β β βββ TranslatorDialog.tsx # Translation feature
β β βββ HelpDialog.tsx # User guidance
β β βββ ui/ # Reusable UI components
β βββ pages/
β β βββ Index.tsx # Home page
β β βββ Vocabulary.tsx # Practice mode
β β βββ NotFound.tsx
β βββ config.ts # App configuration
β βββ main.tsx
βββ public/
β βββ models/
β βββ alphabet_tfjs/ # Your trained model
βββ training_setup/ # Training notebooks and scripts
βββ README.md
See training_setup/ for:
- Dataset preparation notebooks
- Model architecture examples
- Training scripts
- Conversion utilities
- Ensure HTTPS (required for camera access)
- Check browser permissions
- Try desktop Chrome for best compatibility
- Verify all model files are in
public/models/alphabet_tfjs/ - Check console for specific error messages
- Ensure
labels.jsonclass count matches model output
- Improve lighting conditions
- Keep hand centered in frame
- Ensure clear background contrast
- Collect more training data
- Fork the repository
- Create a feature branch
- Make your changes
- Submit a pull request
MIT License
- TensorFlow.js team for browser ML capabilities
- Sign language community for datasets and feedback
Built for accessibility and learning