SPaCial_server_api / README.md
cooldan's picture
Update README.md
d44648e verified
|
Raw History Blame Contribute Delete
3.53 kB
---
title: SPaCial AI OCR Service
emoji: πŸ”
colorFrom: blue
colorTo: purple
sdk: docker
sdk_version: "4.21.0"
app_file: app.py
pinned: false
license: mit
---
# SPaCial AI OCR Service πŸ”
Advanced OCR service using PaddleOCR for dimension detection in technical drawings. Perfect for extracting measurements, tolerances, and text from engineering drawings.
## πŸš€ Features
- **High-Accuracy OCR**: Uses PaddleOCR with multiple detection modes
- **Dimension Detection**: Automatically identifies measurements and tolerances
- **Vertical Text Support**: Handles rotated text (90Β°, 180Β°, 270Β°)
- **Interactive Canvas**: Draw rectangles or click to detect text
- **Real-time Processing**: Fast and efficient text extraction
- **Multiple Modes**: Fast, accurate, and hardcore detection modes
## 🎯 How to Use
### 1. Upload an Image
- Click "Choose File" to upload a technical drawing
- Supported formats: JPG, PNG, WebP
### 2. Auto-Detection
- The system automatically detects all text zones
- Each zone shows confidence percentage and rotation angle
### 3. Manual Selection
- **Double-click**: Click on any text to detect it precisely
- **Draw Rectangle**: Drag to draw a rectangle around text for better detection
### 4. Zone Management
- **Rotate**: Click the rotate button to improve vertical text detection
- **Fit**: Click thumbnail to re-OCR with better accuracy
- **Delete**: Remove unwanted zones
## πŸ”§ API Endpoints
### Process Image
```
POST /ocr/process
- file: Image file
- mode: "fast", "accurate", or "hardcore"
- rotation: 0, 90, 180, 270 degrees
```
### Process Center Point
```
POST /ocr/process-center
- image: Base64 encoded image
- center_point: {"x": x, "y": y}
- rectangle_bounds: {"x1": x1, "y1": y1, "x2": x2, "y2": y2}
- use_rectangle: true/false
- rotation: rotation angle
```
## πŸ› οΈ Technical Details
### Detection Modes
- **Fast**: Quick detection for position finding
- **Accurate**: Balanced speed and accuracy
- **Hardcore**: Maximum accuracy with preprocessing
### Vertical Text Handling
- Automatic detection of vertical text regions
- 90Β° rotation for better OCR accuracy
- Proper coordinate mapping back to original image
### Text Correction
- Built-in correction rules for common OCR errors
- Tolerance parsing for engineering measurements
- Dimension validation and formatting
## πŸ“Š Performance
- **Processing Time**: 1-3 seconds per image
- **Accuracy**: 95%+ for clear technical drawings
- **Supported Languages**: English (optimized for numbers and dimensions)
- **Image Size**: Up to 10MB, auto-resized for processing
## πŸ” Use Cases
- **Engineering Drawings**: Extract dimensions and tolerances
- **Technical Documentation**: Digitize handwritten measurements
- **Quality Control**: Verify measurements on drawings
- **CAD Integration**: Convert scanned drawings to digital data
## 🚨 Troubleshooting
### Common Issues
1. **Low Confidence**: Try "hardcore" mode or draw a rectangle around text
2. **Vertical Text**: Use the rotate button to improve detection
3. **Split Text**: Draw a rectangle to capture the full text
4. **Small Text**: Ensure image resolution is sufficient
### Tips for Best Results
- Use high-contrast images
- Ensure text is clearly visible
- For vertical text, use the rotate feature
- Draw rectangles around complex text regions
## πŸ“ License
This project is part of the SPaCial AI system for technical drawing analysis.
---
**Ready to extract text from your technical drawings? Upload an image and start detecting!** 🎯