How whereitswrong/smart_plate_project works
Project type and purpose
• From the README (“한이음 2022 공모전 Helth-fit 프로젝트”) and the file tree, this is a cross-platform health-fitness system combining:
• Embedded/IoT (Arduino sketches for AT command checking and calibration)
• Mobile (two Android apps: “Main” for core user experience including object detection and server communication, and “beacontry” for BLE beacon scanning)
• Machine Learning (YOLOv5 codebase for model training/export, with TorchScript models bundled into the “Main” app)
File structure and key directories
• Arduino/: sensor/actuator firmware for device-side data acquisition
• Main/: Android Studio application
• app/src/main/java/com/example/main: Activities and Fragments (CameraX integration, object detection, login/signup, network API via RetrofitClient/ServiceApi)
• app/src/main/assets: TorchScript model files (.ptl), class definitions, HTML templates for SNS integration
• beacontry/: lightweight Android app for BLE beacon discovery (BeaconScan.java, PermissionSupport.java)
• yolov5/: full YOLOv5 Python repository used offline for model training, evaluation, exporting to TorchScript/ONNX, plus utility scripts and a Flask REST API example for inference
README for additional insights
• No detailed architecture description, but the presence of RetrofitClient/ServiceApi implies a backend REST service to which the “Main” app reports or fetches data (e.g., user login/signup, result upload).
Main components
a. IoT Devices (Arduino)
– ATcommandCheck module
– Calibration module
b. Mobile Layer
– “beacontry” BLE Scanner App
– “Main” Android App
• CameraX subsystem
• PrePostProcessor & TorchScript Model Inference
• UI Fragments (Food, Record, Communication)
• RetrofitClient → ServiceApi (REST API)
c. Backend Service
– RESTful API endpoints for authentication (LoginData/LoginResponse, JoinData/JoinResponse)
– Data storage (user profiles, detection records, SNS posts)
d. ML Pipeline (Offline)
– YOLOv5 training scripts (train.py, classify/train.py)
– Model export (export.py → TorchScript, ONNX)
– (Optional) Flask REST API example for cloud inference
e. External Services
– SNS integration (HTML templates for SNS main/upload/write)
– (Optional) Cloud hosting for Flask API or other services
Relationships and interactions
• Arduino → BLE → beacontry App (alarms, presence detection)
• User uses “Main” App:
• Camera feed → PrePostProcessor → TorchScript Model → ResultView
• User data (Login/Signup) & detection results → RetrofitClient → Backend REST API
• Optionally, SNS HTML pages served/rendered locally or via backend
• ML pipeline (offline) produces model artifacts → copied into Main/app/src/main/assets
Architectural patterns & design principles
• Modular separation:
• Firmware (Arduino)
• Mobile Presentation Layer (Activities/Fragments)
• Domain Layer (PrePostProcessor, object detection pipeline)
• Data Layer (RetrofitClient/ServiceApi)
• Use of TorchScript for embedding ML in mobile (no runtime Python dependency)
• BLE beacon scanning as a separate micro-app for decoupling presence detection
• Offline/Online dichotomy: offline training vs. on-device inference + online backend communication
Final recommendations
• Be exhaustive: break “Main” app into UI, processing, networking, and assets.
• Both the development pipeline (YOLOv5 → export → assets) and the runtime flow.
• Clear labels on all ports/interfaces (e.g., BLE, REST, file assets).