Skip to content

Merging cnn - #2

Merged
Trexz14 merged 5 commits into
mainfrom
MergingCNN
Jun 9, 2026
Merged

Trexz14 merged 5 commits into
mainfrom
MergingCNN

Conversation

@Trexz14

@Trexz14 Trexz14 commented Jun 9, 2026

Copy link
Copy Markdown
Collaborator

No description provided.

Copilot AI review requested due to automatic review settings June 9, 2026 12:49
@Trexz14
Trexz14 merged commit 43ca519 into main Jun 9, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.py to support train/test splitting, multi-epoch streaming, inference runs, and optional CNN+RF ensemble evaluation.
  • Vendor EscapeNetSmall CNN implementation into scripts/Arduino/Arduino.ino and add scikit-learn (plus transitive deps in uv.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;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants