This repository provides a standalone implementation of wire detection using an EfficientNetB7-based U-Net architecture for automated disassembly processes in robotics applications.
Key Features:
- π― EfficientNetB7 Backbone: State-of-the-art encoder for wire segmentation
- π¬ U-Net Architecture: Precise pixel-level wire localization
- π High Accuracy: Robust wire detection in complex scenes
- π Modern TensorFlow 2.x: Compatible with latest frameworks
- π Pure Python: Standalone usage without ROS dependency
| Input Image | Detected Wires |
|---|---|
![]() |
![]() |
The detection pipeline processes RGB images through the EfficientNetB7-UNet to produce wire segmentation masks.
Performance comparison of different backbone architectures on wire detection task.
This wire detection module is designed for setups where a monocular camera faces the device's surface perpendicularly. The system consists of two main components:
The data generation pipeline addresses the challenge of limited annotated training data by implementing aggressive augmentation strategies. Starting from a small set of user-annotated raw images, the system generates a massive number of augmented images along with their corresponding annotations. This approach enables the deep neural network to learn robust wire detection features despite the initial data scarcity.
The detection model processes RGB images from the monocular camera to identify learned wire features and generate pixel-level segmentation maps. The architecture employs EfficientNetB7 as the encoder backbone within a U-Net framework, leveraging pre-trained ImageNet weights for effective transfer learning.
The training pipeline showing data augmentation and model architecture. The EfficientNetB7 encoder is trained on massively augmented data to achieve robust wire segmentation.
Key Technical Aspects:
- Camera Setup: Monocular camera with perpendicular view to device surface
- Data Augmentation: Extensive augmentation from limited annotated samples
- Architecture: EfficientNetB7-UNet for semantic segmentation
- Training Strategy: Transfer learning with ImageNet pre-trained weights
- Output: Pixel-level binary segmentation masks for wire detection
The wire detection system was developed and validated using a specialized dataset focused on digital entertainment devices:
- Domain: Wire detection in disassembled DVD players, gaming consoles, and similar devices
- Raw Images: 100 top-down images collected from online sources
- Manual Annotation: All visible wires hand-annotated for ground truth
- Augmented Dataset: ~20,000 augmented images generated for robust training
- Augmentation Ratio: 200Γ expansion from original dataset
π¦ WireDTF Dataset: The training data is available as TensorFlow Records on Zenodo:
- Dataset Name: WireDTF (Wire Detection TensorFlow Records)
- Download: WireDTF on Zenodo
- Format: TensorFlow Records (.tfrecord)
- Purpose: Direct loading for DCNN training
This aggressive augmentation strategy addresses the challenge of limited annotated data while ensuring the model learns invariant wire features across various conditions.
The model performance is assessed using two complementary metrics:
1. IoU (Intersection over Union) / F1 Score
Standard metric for pixel-wise segmentation accuracy. Measures the overlap between predicted and ground truth segmentation:
IoU = (Prediction β© Ground Truth) / (Prediction βͺ Ground Truth)
2. SSIM (Structural Similarity Index)
Perceptual metric that evaluates image quality based on luminance, contrast, and structural information. SSIM provides insight into how well the predicted segmentation preserves the structural characteristics of wire patterns.
Comprehensive evaluation of state-of-the-art encoder architectures:
| Model | SSIM (Max/Mean/Min) | IoU (Max/Mean/Min) |
|---|---|---|
| EfficientNetB7 β | 0.956 / 0.877 / 0.761 | 0.988 / 0.952 / 0.897 |
| InceptionV3 | 0.944 / 0.863 / 0.758 | 0.977 / 0.947 / 0.894 |
| InceptionResNetV2 | 0.941 / 0.859 / 0.743 | 0.983 / 0.943 / 0.886 |
| DenseNet201 | 0.940 / 0.862 / 0.747 | 0.978 / 0.945 / 0.891 |
Key Findings:
- EfficientNetB7 achieves the highest scores in both SSIM and IoU metrics
- Superior performance in low-resolution and low-feature conditions
- Demonstrates robust feature extraction capabilities for wire detection
- Mean IoU of 0.952 indicates excellent segmentation accuracy
- High SSIM scores confirm structural similarity preservation
- Methodology
- Dataset & Evaluation
- Quick Start
- Installation
- Usage
- Project Structure
- Model Architecture
- Output Format
- Testing
- Citation
- Contact
git clone https://github.com/eyildiz-ugoe/wire_detection.git
cd wire_detection
python3 -m venv venv && source venv/bin/activate
pip install -r requirements.txt
# Run detection on sample image
python scripts/standalone_detection.py \
--image assets/input.png \
--weights models/efficientnetb7_unet.h5 \
--output-dir results/git clone https://github.com/eyildiz-ugoe/wire_detection.git
cd wire_detection
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txtRequirements: Python 3.8+, TensorFlow 2.15+, OpenCV, NumPy, scikit-image, PyYAML
- Download from Google Drive (~288 MB)
- Place as
models/efficientnetb7_unet.h5
# Basic usage
python scripts/standalone_detection.py \
--image path/to/image.png \
--weights models/efficientnetb7_unet.h5 \
--output-dir results/
# Using environment variable
export WIRE_DETECTION_WEIGHTS=models/efficientnetb7_unet.h5
python scripts/standalone_detection.py --image input.png --output-dir results/from src.wire_detection import load_wire_model, get_prediction, get_wire_pixel
# Load model and run detection
model = load_wire_model('models/efficientnetb7_unet.h5')
pred, contours, mask_paths, overlay_path = get_prediction('input.png', 'output/', model)
wire_pixels = get_wire_pixel(contours)
print(f"Detected {len(contours)} wire segment(s)")wire_detection/
βββ src/ # Core library
β βββ wire_detection.py
βββ scripts/ # CLI tools
β βββ standalone_detection.py
βββ tests/ # Unit tests (6 tests)
β βββ test_wire_detection.py
βββ assets/ # Example images
β βββ input.png
β βββ output.png
βββ models/ # Pre-trained weights
βββ efficientnetb7_unet.h5
Efficient-UNet:
- Encoder: EfficientNetB7 (pre-trained on ImageNet)
- Decoder: U-Net upsampling path
- Input: 256Γ256Γ3 RGB images
- Output: Binary segmentation mask (256Γ256)
- Parameters: ~66M trainable parameters
- Framework: TensorFlow 2.x / Keras
- Wire Overlay (
wire_map.png): RGB visualization with detected wires in red - Segment Masks (
part_mask_segment*.png): Individual binary masks - Metadata (
wire_detection_data.json): Contour coordinates and bounding boxes
python -m pytest tests/ -v
# All 6 tests should pass β
This work is part of the visual intelligence system for automated disassembly.
π Read the Paper: An Extended Visual Intelligence Scheme for Disassembly in Automated Recycling Routines
Published in Communications in Computer and Information Science, November 2022
If helpful in your research, please cite:
@inproceedings{yildiz2022extended,
title={An Extended Visual Intelligence Scheme for Disassembly in Automated Recycling Routines},
author={Yildiz, Erenus and Renaudo, Erwan and Hollenstein, Jakob and Piater, Justus and W{\"o}rg{\"o}tter, Florentin},
booktitle={Robotics, Computer Vision and Intelligent Systems},
series={Communications in Computer and Information Science},
year={2022},
publisher={Springer},
doi={10.1007/978-3-031-19650-8_2}
}Authors: Erenus Yildiz, Erwan Renaudo, Jakob Hollenstein, Justus Piater, Florentin WΓΆrgΓΆtter
ModuleNotFoundError: Run from repository root or set PYTHONPATH
export PYTHONPATH="${PYTHONPATH}:$(pwd)"TensorFlow GPU errors: Use CPU mode
CUDA_VISIBLE_DEVICES="" python scripts/standalone_detection.py ...- Issues: GitHub Issues
- Author: Erenus Yildiz ([email protected])
β
Pure Python (no ROS dependency)
β
TensorFlow 2.x support
β
Command-line interface
β
Clean API & comprehensive docs
β
Unit tests & example assets




