{"id":23777601,"url":"https://github.com/philippmatthes/tmd","last_synced_at":"2026-04-22T16:37:44.112Z","repository":{"id":133110227,"uuid":"516334477","full_name":"PhilippMatthes/tmd","owner":"PhilippMatthes","description":"TFLite models and Flutter library for transport mode detection on mobile devices. (IEEE IoTaIS 2022)","archived":false,"fork":false,"pushed_at":"2024-01-09T09:57:21.000Z","size":8098,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-02T13:13:16.865Z","etag":null,"topics":["flutter","flutter-library","shl","shl-dataset","tmd","transport-mode-detection"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PhilippMatthes.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2022-07-21T10:58:37.000Z","updated_at":"2024-01-13T17:10:31.000Z","dependencies_parsed_at":null,"dependency_job_id":"fe2d2459-cb80-49b7-9ed4-cd9700e6dd92","html_url":"https://github.com/PhilippMatthes/tmd","commit_stats":null,"previous_names":["philippmatthes/tmd"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/PhilippMatthes/tmd","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PhilippMatthes%2Ftmd","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PhilippMatthes%2Ftmd/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PhilippMatthes%2Ftmd/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PhilippMatthes%2Ftmd/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PhilippMatthes","download_url":"https://codeload.github.com/PhilippMatthes/tmd/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PhilippMatthes%2Ftmd/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32145870,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-22T15:33:03.595Z","status":"ssl_error","status_checked_at":"2026-04-22T15:30:42.712Z","response_time":58,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["flutter","flutter-library","shl","shl-dataset","tmd","transport-mode-detection"],"created_at":"2025-01-01T08:47:31.660Z","updated_at":"2026-04-22T16:37:39.101Z","avatar_url":"https://github.com/PhilippMatthes.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Transport Mode Detection for Smartphones\n\nTFLite Machine learning models trained for transport mode detection (TMD) on smartphones. This library provides a simple API to use these models in your Flutter app. The models were trained and evaluated on the SHL (Sussex-Huawei-Locomotion) dataset.\n\n\u003cp align=\"center\"\u003e\n\u003cimg src=\"screenshots/example-app.png\" height=\"300\"\u003e\n\u003c/p\u003e\n\n## Installing\n\nAdd this library to your `pubspec.yaml` via GitHub:\n\n```yaml\ndependencies:\n  tmd:\n    git:\n      url: https://github.com/philippmatthes/tmd\n      ref: main\n```\n\n## Example Usage\n\n```dart\nimport 'package:tmd/tmd.dart';\n\nvoid main() async {\n  final tmd = TMD();\n  final stream = await tmd.startListeningForChanges()\n  stream.listen((newMode) {\n    print(newMode); // New transport mode detected\n  });\n}\n```\n\nThere is also the option to specify how often the model should be evaluated, and how often the changed transport mode should be cross-checked before reporting the change.\n\n```dart\nimport 'package:tmd/tmd.dart';\n\nvoid main() async {\n  final tmd = TMD();\n  final stream = await tmd.startListeningForChanges(\n    // Notify only if a new transport mode was detected that many\n    // consecutive times. This will improve the stability at the\n    // expense of a less frequent notification.\n    nChangedForNotification: 5,\n    // The inference period defines how often the transport mode\n    // is inferred. This will also affect the notification frequency.\n    // Note that the inference period also impacts the battery life.\n    // It is recommended to not go below 0.5 seconds.\n    inferencePeriod: const Duration(milliseconds: 1000),\n  );\n  stream.listen((newMode) {\n    print(newMode); // New transport mode detected\n  });\n}\n```\n\n## Designed for Low Resource Usage\n\n![Battery Impact](screenshots/profiler.png)\n\nRead our paper to learn more about how we optimized the model for low resource usage: [Selecting Resource-Efficient ML Models for Transport Mode Detection on Mobile Devices](https://ieeexplore.ieee.org/abstract/document/9976004/).\n\n## Known Issues\n\n- Currently, the IMU sensor stream is kept active even when the transport mode detection does not need it.\n- Transport mode \"car\" may be detected instead of \"still\" when the smartphone lays flat on the table.\n- The detection may vary between devices depending on the sensor quality and sampling rate.\n\nPlease help us improve this library by cross-checking results and reporting any issues you encounter.\n\n## TFLite Models Download\n\nThe model in the first row is the model used by default in this library.\n\n| Model ID | Type | Pooling | Optimizer | Optimization | Depth | LR | Val. Acc. (%) | Download |\n| --- | --- | --- | --- | --- | --- | --- | --- | --- |\n|4ad2e7|1d ResNetV1|max|adam|Pruning \u0026 Separable Layers|2|0.010|84.91|[Google Drive](https://drive.google.com/file/d/1-JH0K0vsLOuqiTp2PAIPoLXRUyvvk36p/view?usp=sharing)|\n|4ad2e7|1d ResNetV1|max|adam|Pruning|2|0.010|84.38|[Google Drive](https://drive.google.com/file/d/1Dj7Op4LArlK0gnkGpqvbj6uetNlxNSL3/view?usp=sharing)|\n|4ad2e7|1d ResNetV1|max|adam|-|2|0.010|84.34|[Google Drive](https://drive.google.com/file/d/1-CyUZTibwya5l2j2l_StHtYe_u2tOJ04/view?usp=sharing)|\n|6af8a1|1d ResNetV1|max|adam|-|4|0.010|84.18|[Google Drive](https://drive.google.com/file/d/1-LkSVciKyGQkO6YyAqHazqArNhfgc5U3/view?usp=sharing)|\n|7cfd66|1d ResNetV1|max|sgd|-|2|0.100|84.18|[Google Drive](https://drive.google.com/file/d/1-8kybhtQut8Mz-6zz0UfFssz_t_yqCGQ/view?usp=sharing)|\n|968ca3|1d ResNetV1|max|sgd|-|2|0.100|84.03|[Google Drive](https://drive.google.com/file/d/1-1UjIR3Qs-2oZD49AVnbmPpeLG05iKDJ/view?usp=sharing)|\n|e6c367|1d ResNetV1|avg|adam|-|3|0.001|83.69|[Google Drive](https://drive.google.com/file/d/1-1Uurz7PfFuw9-wdV-DfH7EQGEFgopZs/view?usp=sharing)|\n|998822|1d ResNetV2|max|sgd|-|2|0.010|82.92|[Google Drive](https://drive.google.com/file/d/1-_hmv7INFEIGTRC2Lz7H8NJCEC22zFLI/view?usp=sharing)|\n|752315|2d ResNetV2|avg|rmsprop|-|2|0.010|81.33|[Google Drive](https://drive.google.com/file/d/1-4n6KBRXdm2Dz-D6tZHM4NYsf-d40FSj/view?usp=sharing)|\n|35d171|2d ResNetV1|avg|adam|-|2|0.010|81.07|[Google Drive](https://drive.google.com/file/d/1-8DgA9znYzIKrfPmHxaCgkz8VPFRaswu/view?usp=sharing)|\n|ea7037|1d ResNetV1|avg|adam|-|3|0.001|81.01|[Google Drive](https://drive.google.com/file/d/1-ROstQ3WI8ZtCy8xDzDMg-UhFlT8wC8s/view?usp=sharing)|\n|cb5048|2d ResNetV1|max|adam|-|2|0.010|78.96|[Google Drive](https://drive.google.com/file/d/1-00pwU2B3yer4jPU4Wp_oP2OIVCNwB_5/view?usp=sharing)|\n\nAll models were trained and evaluated on the SHL dataset. If any of the download links do not work, here is a backup: [Google Drive](https://drive.google.com/file/d/15XombGG_j4ngN7l-tNMKB4WnXqRv6G7o/view?usp=sharing). Please open an issue in this case.\n\n## Citing this Work\n\n```bibtex\n@inproceedings{matthes2022selecting,\n  title={Selecting Resource-Efficient ML Models for Transport Mode Detection on Mobile Devices},\n  author={Matthes, Philipp and Springer, Thomas},\n  booktitle={2022 IEEE International Conference on Internet of Things and Intelligence Systems (IoTaIS)},\n  pages={135--141},\n  year={2022},\n  organization={IEEE}\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphilippmatthes%2Ftmd","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphilippmatthes%2Ftmd","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphilippmatthes%2Ftmd/lists"}