| --- |
| license: mit |
| task_categories: |
| - feature-extraction |
| language: |
| - en |
| tags: |
| - sensor |
| - physics |
| --- |
| |
|
|
| # Hand Detection Training Data |
|
|
| This folder contains sensor data collected from mobile devices for training the hand detection model. |
|
|
| ## Overview |
|
|
| The dataset includes accelerometer and gyroscope readings from 2 subjects, each holding a device with both their left and right hands. This data is used to train the Random Forest classifier that achieves 94.6% accuracy in detecting which hand is holding the device. |
|
|
| ## Directory Structure |
|
|
| ``` |
| hand_data/ |
| ├── accelerometer/ # Accelerometer sensor data (primary) |
| │ ├── s-1_left_hand.csv # Subject 1, left hand (39,102 samples) |
| │ ├── s-1_right_hand.csv # Subject 1, right hand (30,528 samples) |
| │ ├── s-2_left_hand.csv # Subject 2, left hand (44,724 samples) |
| │ └── s-2_right_hand.csv # Subject 2, right hand (35,408 samples) |
| │ |
| └── gyrocop/ # Gyroscope data (supplementary) |
| ├── s-1_left_hand.csv # Subject 1, left hand |
| └── s-1_right_hand.csv # Subject 1, right hand |
| ``` |
|
|
| ## Data Format |
|
|
| ### Accelerometer Data |
|
|
| Each CSV file contains timestamped 3-axis accelerometer readings: |
|
|
| | Column | Type | Description | |
| |-----------|-----------|------------------------------------------| |
| | timestamp | datetime | ISO 8601 format (e.g., 2025-12-27T09:13:07.598506) | |
| | x | float | X-axis acceleration (m/s²) | |
| | y | float | Y-axis acceleration (m/s²) | |
| | z | float | Z-axis acceleration (m/s²) | |
|
|
| **Example:** |
| ```csv |
| timestamp,x,y,z |
| 2025-12-27T09:13:07.598506,0.849452,3.895515,8.087741 |
| 2025-12-27T09:13:08.083118,0.727418,4.000800,8.099705 |
| ``` |
|
|
| ### Gyroscope Data |
|
|
| Similar structure with angular velocity measurements (°/s). |
|
|
| ## Dataset Statistics |
|
|
| ### Total Samples |
| - **Subject 1 (Left)**: 39,102 samples |
| - **Subject 1 (Right)**: 30,528 samples |
| - **Subject 2 (Left)**: 44,724 samples |
| - **Subject 2 (Right)**: 35,408 samples |
| - **Total**: 149,762 samples |
|
|
| ### Collection Method |
| - Device: Mobile phone with accelerometer sensor |
| - Sampling rate: ~50-100 Hz (varies) |
| - Duration: Multiple sessions per subject/hand |
| - Environment: Normal daily usage patterns |
|
|
| ## Data Characteristics |
|
|
| ### X-Axis (Left/Right Tilt) |
| - **Primary discriminator** for hand detection |
| - Left hand: Positive values (device tilts right) |
| - Right hand: Negative values (device tilts left) |
| - Statistical significance: p < 0.000001 |
|
|
| ### Y-Axis (Forward/Backward Tilt) |
| - Secondary feature |
| - Shows hand-specific patterns |
| - Less discriminative than X-axis |
|
|
| ### Z-Axis (Vertical) |
| - Represents gravity component |
| - Generally around 9.8 m/s² when stationary |
| - Varies with device orientation |
|
|
| ### Magnitude |
| - Calculated: √(x² + y² + z²) |
| - Overall movement intensity |
| - Helps distinguish activity levels |
|
|
| ## Usage in Training |
|
|
| This data is used in [../which_hand_you_use.ipynb](https://github.com/rockerritesh/sensor/blob/main/hand/which_hand_you_use.ipynb) for: |
|
|
| 1. **Exploratory Data Analysis (EDA)** |
| - Distribution analysis |
| - Statistical testing |
| - Correlation analysis |
| - Time series visualization |
|
|
| 2. **Feature Engineering** |
| - Calculate magnitude |
| - Window-based statistics (mean, std, min, max) |
| - Temporal features (deltas, trends) |
|
|
| 3. **Model Training** |
| - Single-point Random Forest (94.6% accuracy) |
| - Windowed Random Forest (96%+ accuracy) |
| - PCA for visualization |
|
|
| ## File Sizes |
|
|
| - `s-1_left_hand.csv`: ~2.1 MB |
| - `s-1_right_hand.csv`: ~1.7 MB |
| - `s-2_left_hand.csv`: ~2.4 MB |
| - `s-2_right_hand.csv`: ~2.0 MB |
|
|
| **Total**: ~8.2 MB (accelerometer only) |
|
|
| ## Data Quality |
|
|
| ### Completeness |
| ✅ No missing values |
| ✅ Continuous timestamps |
| ✅ Consistent format across all files |
|
|
| ### Statistical Validation |
| ✅ Normal distribution per axis |
| ✅ Significant hand differences (p < 0.05) |
| ✅ Consistent patterns across subjects |
|
|
| ## Privacy & Ethics |
|
|
| - Data collected with informed consent |
| - No personally identifiable information |
| - Used solely for research purposes |
| - Anonymized subject identifiers (S1, S2) |
|
|
| ## Collection Guidelines |
|
|
| If collecting additional data: |
|
|
| 1. **Consistency**: Use same device/settings |
| 2. **Duration**: Minimum 5-10 minutes per hand |
| 3. **Activity**: Natural usage (browsing, typing, etc.) |
| 4. **Labeling**: Clear hand identification |
| 5. **Format**: Match existing CSV structure |
|
|
| ## Notes |
|
|
| - This data is **excluded from git** (see `.gitignore`) |
| - Keep data locally or use Git LFS for large files |
| - Model files are generated from this data |
| - Data collection scripts in `shared/` folder |
|
|
| ## Related Files |
|
|
| - **Training**: [../which_hand_you_use.ipynb](https://github.com/rockerritesh/sensor/blob/main/hand/which_hand_you_use.ipynb) |
| - **Models**: `hand_classifier_*.pkl` files |
| - **Collection**: `collect_data.py` in shared folder |
|
|
| --- |
|
|
| **Last Updated**: December 2025 |
| **Format Version**: 1.0 |
| **Total Samples**: 149,762 |
|
|