Download implementation_plan.md from FaustDerLegende/Micro_component_dataset: direct link, hf CLI and curl.
- Browser
- Download file 4.31 kB
-
https://huggingface.co/datasets/FaustDerLegende/Micro_component_dataset/resolve/main/implementation_plan.md
- Command line
-
hf download hf://datasets/FaustDerLegende/Micro_component_dataset/implementation_plan.md
-
curl -L -o implementation_plan.md https://huggingface.co/datasets/FaustDerLegende/Micro_component_dataset/resolve/main/implementation_plan.md
Implementation Plan: E-Waste Dataset Scraper & Pipeline (v2 Architecture)
Build a modular, production-grade Python web scraper and image preprocessing pipeline following scraper_plan_v2.md to harvest, clean, deduplicate, and prepare high-resolution e-waste PCB dataset images for fine-tuning YOLOv8 micro-component detectors.
User Review Required
Scraping Target & Volume: The pilot harvest target will be set to 500 images per query batch across Bing and Flickr to keep the pilot run under 10–15 minutes while establishing real attrition rates. Dependency Note:
icrawler,pillow,imagehash, andopen_clip_torch(or lightweight CLIP filtering) will be installed in the environment.
Open Questions
CLIP Relevance Filter Mode: Should the initial script execute CLIP zero-shot relevance filtering locally via PyTorch, or fall back to rule-based aspect-ratio/color-histogram heuristic filtering if PyTorch GPU memory is constrained during background runs? (Default: Rule-based + optional CLIP module).
Proposed Changes
Scraping & Pipeline Package (ewaste_dataset_pipeline/)
Creation of a self-contained, modular Python CLI pipeline under ewaste_dataset_pipeline/.
[NEW] config/taxonomy.yaml
- Defines the 5 target YOLO detection classes:
cpu_socket,gold_finger,ic_chip,tantalum_capacitor,desoldered_zone. - Defines image-level tags:
board_type,condition,source_type.
[NEW] config/queries.yaml
- Search query expansion matrix across search terms, condition variants, board types, and multilingual terms.
[NEW] pipeline/manifest.py
- SQLite database abstraction layer (
manifest.db) tracking URL provenance, download status, MD5 checksums, resolution, pHash values, cluster IDs, and split assignments.
[NEW] pipeline/crawler.py
- URL harvester using
icrawler(Bing, Flickr, Baidu) with exponential backoff retries, custom headers, and rate limiting. Saves raw bytes todata/originals/.
[NEW] pipeline/validator.py
- Validation engine checking file integrity (
verify()+load()), short/long resolution cutoffs ($\ge 480\text{ px}$ short side), and aspect ratio bounds (flag $> 3:1$, drop $> 6:1$).
[NEW] pipeline/processor.py
- Image normalizer handling EXIF auto-rotation (
exif_transpose), RGBA alpha white-background compositing, CMYK to RGB conversion, and JPEG 95 quality encoding.
[NEW] pipeline/dedup.py
- Multi-tier deduplication engine (SHA-256 exact byte hash + perceptual
pHash/dHashwith horizontal flip awareness).
[NEW] scraper.py
- Unified CLI entry point supporting subcommands:
harvest,validate,process,dedup,report.
[NEW] requirements.txt
- Dependency specifications (
icrawler,Pillow,imagehash,pyyaml,tqdm).
Verification Plan
Automated Verification
- Unit & Module Tests:
- Test image validation on corrupted, truncated, transparent PNG, CMYK, and EXIF-rotated sample images.
- Verify pHash deduplication on identical vs resized/flipped images.
- CLI Execution Runs:
- Execute pilot harvest run:
cd ewaste_dataset_pipeline python3 scraper.py harvest --max-num 50 python3 scraper.py validate python3 scraper.py process python3 scraper.py dedup python3 scraper.py report
- Execute pilot harvest run:
Manual Verification
- Inspect generated
reports/summary.jsonto verify image yield, discard counts by reason, and cleandataset_raw/outputs.