Repository navigation
Merging cnn - #2
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the PC↔Arduino training/inference pipeline to use an on-device “EscapeNet SMALL” CNN with a new self-synchronizing serial protocol, and adds a PC-side Random Forest option for ensemble evaluation.
Changes:
- Switch serial protocol to
[0xFE][label][28×50 uint8 pixels]with[0xFF]ACK for training and 3 probability bytes for inference. - Refactor
stream_signatures.pyto support train/test splitting, multi-epoch streaming, inference runs, and optional CNN+RF ensemble evaluation. - Vendor EscapeNetSmall CNN implementation into
scripts/Arduino/Arduino.inoand addscikit-learn(plus transitive deps inuv.lock).
Reviewed changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
uv.lock |
Locks new Python dependencies needed for the updated streaming + optional ensemble workflow. |
pyproject.toml |
Adds scikit-learn dependency for the optional Random Forest ensemble path. |
scripts/stream_signatures.py |
Implements new serial protocol, preprocessing, train/test split, epochs, inference, and optional RF ensemble. |
scripts/Arduino/Arduino.ino |
Replaces prior signature receiver with EscapeNet SMALL CNN + new sync/probability-byte protocol. |
scripts/CNN/EscapeNetSmall/EscapeNetSmall.ino |
Removes the standalone sketch (CNN code is now embedded in Arduino.ino). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
60
to
61
| # Set to True to print all available serial ports and exit | ||
| LIST_PORTS = False |
Comment on lines
+74
to
+75
| MAX_RETRIES = 4 | ||
| RESYNC_WAIT = 0.6 # must exceed Arduino SIGNATURE_TIMEOUT_MS (400 ms) |
Comment on lines
+270
to
+277
| static bool read_exact(uint8_t* dst, int n) { | ||
| int got = 0; | ||
| unsigned long t0 = millis(); | ||
| while (got < n) { | ||
| if (Serial.available()) dst[got++] = (uint8_t)Serial.read(); | ||
| else if (millis() - t0 > 5000) return false; | ||
| } | ||
| return true; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.