Project Info
This project did not submit a demo video on Devpost.
As a biology student, chemistry laboratory courses are an unavoidable part of my curriculum. Many experiments rely heavily on thin-layer chromatography (TLC), whether it's monitoring reaction progress in Suzuki coupling reactions or checking fractions during column chromatography purification. In a typical lab session, I often need to analyze five or more TLC plates. The process involves taking pictures, measuring solvent fronts manually, calculating Rf values by hand, and recording everything in lab notebooks. These repetitive tasks are time-consuming, prone to human error, and often produce inconsistent results. I wanted to build a tool that transforms TLC analysis from a manual process into a smart and automated workflow. Auto Chem is an AI-assisted TLC analysis and documentation platform. The software can: Automatically detect and crop TLC plate images from photos. Correct perspective distortion to standardize plate orientation. Identify solvent fronts, baseline positions, and spot locations. Calculate Rf values automatically. Use third-party AI APIs together with computer vision to improve spot recognition. Continuously improve detection accuracy through YOLO-based training. Save experiments with one click and maintain an archive of previous TLC plates. Generate AI-powered experimental reports automatically, reducing manual documentation work. Ultimately, Auto Chem aims to bridge computer vision and chemical laboratory workflows. I built Auto Chem using: SwiftUI for a native macOS interface. A canvas-first workflow that allows manual adjustment when automatic detection is uncertain. SQLite for experiment management and archiving. OpenCV for image preprocessing, perspective correction, and plate standardization. YOLO models for spot detection and future machine-learning improvements. Third-party AI APIs to assist machine vision and generate experiment reports. By combining traditional image processing with AI models, I created a system that is both accurate and user-friendly. One of the biggest challenges was balancing automation with reliability. TLC plates vary significantly between laboratories. Differences in lighting conditions, plate quality, UV intensity, camera angles, and spot appearance make automatic recognition difficult. Some spots are faint, overlapping, or partially invisible, making detection inconsistent. Another challenge was designing a workflow that integrates computer vision, machine learning models, local storage, and external AI services while maintaining a smooth user experience. Finally, because scientific applications require accuracy, I had to ensure users could always manually adjust results whenever automatic detection was uncertain. I'm proud that Auto Chem successfully turns a tedious laboratory task into a streamlined digital workflow. Some achievements I'm especially excited about include: Building a complete end-to-end TLC analysis pipeline. Combining AI with classical computer vision rather than relying on only one approach. Providing both automatic recognition and manual correction for higher reliability. Creating a searchable archive of experiments instead of leaving results scattered across notebooks and photos. Demonstrating how AI can genuinely improve productivity in scientific research rather than simply acting as a chatbot. Through this project, I learned that scientific software requires a different mindset from traditional applications. Accuracy and reproducibility are often more important than full automation. I also learned that machine learning alone is rarely enough; combining domain knowledge with classical image-processing techniques produces much better results. Most importantly, I gained experience integrating UI design, computer vision, AI APIs, and data management into a single product while keeping the workflow intuitive for real laboratory users. My next steps are: Expanding the YOLO training dataset with more annotated TLC images to improve detection accuracy. Supporting more chemical workflows and reaction types. Developing Auto Chem into a full-featured digital chemistry lab notebook. Recording additional experimental metadata such as solvents, reagents, yields, and reaction conditions. Generating more comprehensive AI-powered reports. Building better search and archival tools for long-term experiment management. My long-term vision is to create an intelligent laboratory assistant that helps researchers spend less time on repetitive documentation and more time on science.
Auto Chem
A macOS app for TLC (Thin-Layer Chromatography) plate analysis. Drop in a photo, get Rf values, AI interpretation, and a searchable experiment archive — automatically.
What it does
TLC is a daily routine in organic chemistry labs: develop a plate, hold it under UV, manually measure distances, hand-calculate Rf. Auto Chem automates that process:
- Import a TLC plate photo
- Auto-detect baseline, solvent front, and spots (OpenCV pipeline)
- Calculate Rf values instantly
- Generate an AI report — reaction status, spot interpretation, next-step suggestions
- Save to a searchable local archive
Manual adjustment is always available — drag lines and spots to correct anything the auto-detection got wrong.
Requirements
- macOS 14 (Sonoma) or later
- Python 3.10+ (for the CV sidecar)
- An Anthropic API key (for AI reports)
- Xcode 15+ (to build from source)
Setup
1. Clone the repo
git clone https://github.com/KaiyueLi-Bruce/hackathon.git
cd hackathon
2. Set up the Python sidecar
cd cv
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
3. Start the sidecar
# From the cv/ directory, with .venv activated
python run.py
The sidecar runs at http://localhost:8765 and handles all image processing. Keep this terminal open while using the app.
4. Build and run the app
cd ../App
swift build # or open in Xcode and press ▶
Or open App/ as a Swift package in Xcode and run the Auto Chem target.
5. Add your API key
In the app: click the gear icon (top-right) → paste your Anthropic API key → Save.
Basic workflow
Analyze a plate
- Import a photo — drag and drop a TLC plate image onto the canvas, or click Import in the floating toolbar.
- Auto-detect — click the Auto-detect button (highlighted in the toolbar). The sidecar detects:
- Baseline and solvent front lines
- All spots with their Rf values
- Lane assignments
- Review — Rf values appear in the Results tab on the right. Drag the baseline or solvent front lines to fine-tune if needed. Click spots to add labels (SM / Product / By-product / Standard).
- Generate AI report — switch to the AI tab → click Generate AI report. The report covers:
- Reaction status (complete / incomplete / inconclusive)
- Spot-by-spot interpretation
- Next-step suggestions
- Save — press ⌘S or click the save button. The plate is stored in the local archive with its photo, Rf data, and report.
Browse the archive
Click the grid icon in the left rail to open the archive. Search by experiment name, date, or Rf range.
Teaching the detector (online learning)
The spot detector improves as you correct it:
- Run auto-detect on a plate.
- Add missed spots by clicking on the plate. Remove false positives by double-clicking a spot.
- Save the plate — corrections are immediately fed back to the classifier.
After a few plates the detector learns your typical plate appearance and needs fewer corrections. The inspector shows "Learned from N corrections" to track progress.
YOLO model (optional, higher accuracy)
A YOLOv8-based detector is available as a higher-accuracy fallback. It activates automatically once trained.
Train the YOLO model
cd cv
source .venv/bin/activate
pip install ultralytics # one-time
python train_yolo.py --epochs 50 --n-synth 2000
Training takes ~60–90 minutes on Apple Silicon (MPS). The script:
- Generates 2000 synthetic TLC images from photos in
training_pictures/ - Trains YOLOv8n for 50 epochs
- Exports to
cv/models/yolo_spot.onnx
You can also trigger training from the app: Settings → YOLO Spot Detector → Re-train.
Once the model is ready, the status dot turns green and YOLO is used automatically when the standard detector finds zero spots.
Project structure
hackathon/
├── App/ # SwiftUI macOS app (Swift Package)
│ └── Sources/ChromaLog/
│ ├── AppStore.swift # Central state
│ ├── CVClient.swift # HTTP client for the sidecar
│ └── Views/ # UI components
├── cv/ # Python sidecar (FastAPI + OpenCV)
│ ├── chromalog_cv/ # Detection pipeline
│ │ ├── pipeline.py # Main pipeline entry point
│ │ ├── spots.py # Spot detection & Rf calculation
│ │ ├── rectify.py # Perspective correction
│ │ ├── learn.py # Online incremental classifier (SGD)
│ │ └── yolo.py # YOLO ONNX inference
│ ├── train_yolo.py # YOLO training script
│ ├── models/ # ONNX model files (gitignored)
│ └── tests/ # pytest test suite (45 tests)
├── training_pictures/ # Real TLC photos used for YOLO training
└── docs/ # Design specs
Detection pipeline
Photo
→ Perspective correction (OpenCV contour → homography)
→ CLAHE illumination normalization
→ Auto-polarity binarization (minority class = spots)
→ Hough line detection (baseline + solvent front)
→ Connected-component spot candidates
→ Lane assignment (x-projection histogram)
→ SGD patch classifier (if trained, improves with corrections)
→ YOLO fallback (if model exists and classifier finds 0 spots)
→ Rf = (baselineY − spotY) / (baselineY − frontY)
Running tests
cd cv
source .venv/bin/activate
pytest tests/ -q
45 tests covering detection, learning, YOLO inference, and the FastAPI endpoints.
Keyboard shortcuts
| Action | Shortcut |
|---|---|
| Save plate | ⌘S |
| Toggle left rail | toolbar sidebar button |
| Toggle inspector | toolbar right-sidebar button |
Tech stack
| Layer | Technology |
|---|---|
| macOS UI | SwiftUI (macOS 14+) |
| Local storage | SQLite via GRDB.swift |
| Image processing | Python · OpenCV · FastAPI |
| Spot classification | scikit-learn SGDClassifier (online learning) |
| YOLO detection | Ultralytics YOLOv8n → ONNX Runtime |
| AI reports | Anthropic Claude API |
Analysis
View
Metric
- 44
- 16
Figures cover GitHub contributors during the hackathon window. A co-authored commit counts in full for each author, so per-member totals add up to more than the whole-team figures.
Technology
- FastAPIIn code
- PythonIn code
- SwiftIn code
3 of 3 appear in the indexed code.
AI coding agents
- Claude CodeConfig · Commits
Detected from committed agent config files and commit authorship. Absence of a signal is not proof an agent was unused.
Codebase size
Source size
413 KB
Source files
53
Counts recognized source files only; vendored directories, binaries and lockfiles are excluded, so this is smaller than the repository on disk.
Repository
KaiyueLi-Bruce/hackathon
64 files · 3.5 MB · @ c7d045c
Structure
Interface
23 files · 36%Screens, components and styles rendered to the user.
Application logic
17 files · 27%Domain rules, services and shared utilities.
Supporting
Layers are inferred from where files sit in the tree, not from reading the code. A project that names its directories unconventionally will read oddly here — open the file browser to check anything the diagram implies.
Languages
- Markdown35%
- Python33%
- Swift33%
Share of indexed source by file size. Binary and vendored files are excluded.
Dependencies
cv/requirements.txt
pypi · 7- fastapi
- numpy
- opencv-python-headless
- pillow
- python-multipart
- scikit-learn
- uvicorn[standard]
Declared in the repository’s manifests at the indexed commit. A declared package is not proof it is used, and runtime dependencies are listed first.
This project’s features have not been analysed yet.
Export this project's context (description, README, evidence, key source files) to chat with an AI agent elsewhere.