Spaces:
Sleeping
Sleeping
File size: 11,570 Bytes
daddcbd 3ff3eea 2826c91 3ff3eea 2826c91 3ff3eea 2826c91 3ff3eea 2826c91 3ff3eea 2826c91 3ff3eea 2826c91 3ff3eea 2826c91 51cc5c2 2826c91 3ff3eea 2826c91 3ff3eea 2826c91 3ff3eea 2826c91 3ff3eea 2826c91 3ff3eea 2826c91 3ff3eea | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 | ---
title: Auto Object Annotator 0.0.4
emoji: ๐
colorFrom: yellow
colorTo: green
sdk: docker
sdk_version: "4.0.0"
python_version: "3.9"
app_file: app.py
pinned: false
---
# Spatiotemporal Object Detection Visualizer & Annotator
A professional web-based dual-function application for visualizing and annotating spatiotemporal image datasets. This tool serves as both a **visualizer** for RGB spatially resolved images with their corresponding transient signals, and an **annotator** for creating bounding box annotations with minimal user input.
## ๐ฏ Overview
This application provides **dual functionality** for spatiotemporal object detection datasets:
### ๐ **Visualizer Function**
The tool visualizes RGB spatially resolved images alongside their corresponding transient signals:
- **RGB Spatially Resolved Image** (`-sr_int_full.png`): Surface reflection internal full view showing spatial RGB information
- **Transient Intensity Map** (`-tr_int_full.png`): Transmission internal full view displaying transient signal intensity across all pixels
- **Transient Line Plots** (`-tr_line.png`): Transmission line plots showing transient signal resolved as line plots across pixels
Each image set consists of three related images with the same file ID prefix, allowing synchronized visualization of spatial and temporal information.
### โ๏ธ **Annotator Function**
The annotation system requires only **2 coordinates** (points) made by the user to generate bounding boxes:
- **Point-to-Point Annotation**: Click two points on any image to automatically create a bounding box
- **Minimal Input**: No dragging required - just two clicks define the bounding box corners
- **Multi-View Support**: Annotate on any of the three synchronized views (RGB, intensity, or line plots)
### ๐ค **Export for Model Training**
The application enables export of:
- **RGB images** with their corresponding **bounding boxes**
- **Transient signals** (intensity maps and line plots) associated with each annotation
- **Spatiotemporal data** formatted for object detection model training
This dual functionality makes it ideal for preparing datasets for **spatiotemporal object detection model training**, where both spatial (RGB) and temporal (transient) information are crucial.
## ๐ Key Features
### ๐ **Dataset Management**
- **Multi-folder support**: Automatically processes all folders containing valid image sets
- **File ID grouping**: Images grouped by prefix before '-' character (e.g., `teddy__1-sr_int_full.png`, `teddy__1-tr_line.png`, `teddy__1-tr_int_full.png`)
- **Smart validation**: Only includes folders with complete image sets (all three image types)
- **Continuous workflow**: Seamless navigation through entire dataset
### ๐ผ๏ธ **Image Display**
- **Optimized layout**: Two images side-by-side (50% width each) at top, one full-width image below
- **Smart scaling**:
- `sr_int_full.png` images scaled to 416px width
- `tr_int_full.png` images use original size with 150px cropping from top/bottom
- **Reduced whitespace**: Optimized spacing for better scale number visibility
- **Professional presentation**: Clean, focused image display
### ๐ท๏ธ **Annotation System**
- **Two-point bounding box creation**: Simply click two points to generate rectangular annotations (no dragging required)
- **Point-to-point annotation**: First click sets one corner, second click sets the opposite corner
- **Class-based labeling**: Assign objects to predefined classes
- **Class-based ID system**: Sequential IDs per class (1,2,3... for each class separately)
- **Center-point format**: Annotations saved as x,y center coordinates plus width/height
- **Multi-canvas support**: Annotate on any of the three synchronized views (RGB spatial, transient intensity, or line plots)
### ๐จ **User Interface**
- **Orange color scheme**: Professional orange theme throughout interface
- **Thinner annotation lines**: 2px line width for clean, precise annotations
- **Compact labels**: 60% smaller font size for unobtrusive labeling
- **Transparent buttons**: Outline-only buttons with 50% smaller size
- **Elegant sidebar**: Garamond font, regular weight, gray color
- **Full-height layout**: Sidebar utilizes 100% height efficiently
### ๐ **Zoom & Navigation**
- **Individual zoom controls**: Separate zoom buttons for each image canvas
- **Smart zoom behavior**:
- Starts at 100% fitting display canvas
- Scroll enabled only when zooming over 100%
- Allows magnification beyond 100% for detailed work
- **Gray transparent icons**: Subtle, non-intrusive zoom button appearance
- **Per-canvas positioning**: Zoom buttons positioned on left side of each canvas
### ๐พ **Data Management & Export**
- **Auto-save functionality**: Automatically saves annotations on navigation
- **CSV export format**: Standard CSV with image path, class, coordinates, and dimensions
- **Spatiotemporal export**: Export RGB images with bounding boxes and their corresponding transient signals
- **Model training ready**: Formatted output suitable for spatiotemporal object detection model training
- **Update-safe saving**: Updates existing CSV files or creates new ones
- **Class-based ID assignment**: Maintains separate ID sequences for each class
### ๐ฎ **Auto-Play Feature**
- **Complete dataset coverage**: Cycles through ALL images in entire dataset
- **Infinite loop playback**: Automatically restarts from beginning when complete
- **Customizable timing**: Set any interval from 1 second to minutes
- **Smart navigation**:
- Advances through all sets in current folder
- Automatically moves to next folder when current is complete
- Loops back to first folder for continuous operation
- **User control**: Pause/resume at any time, manual override available
### ๐ **Reset & Management**
- **Flexible reset options**: Clear annotations by folder/class or globally
- **Clean slate capability**: Start fresh when needed
- **Non-destructive workflow**: Reset doesn't affect saved CSV data
## ๐ ๏ธ **Installation & Setup**
### Prerequisites
- Python 3.7+
- Flask
- Modern web browser
### Installation
```bash
# Clone or download the project
cd your-project-directory
# Install dependencies
pip install flask
# Ensure your image dataset is organized in folders with the required image types
```
### Dataset Structure
```
images/
โโโ folder1/
โ โโโ object1-sr_int_full.png
โ โโโ object1-tr_line.png
โ โโโ object1-tr_int_full.png
โ โโโ object2-sr_int_full.png
โ โโโ object2-tr_line.png
โ โโโ object2-tr_int_full.png
โโโ folder2/
โ โโโ ... (similar structure)
โโโ ...
```
## ๐ **Usage**
### Starting the Application
```bash
python app.py
```
Access the application at: `http://127.0.0.1:6700/tagger`
### Basic Workflow
#### As a Visualizer:
1. **Navigate**: Use "Next Set" and "Next Folder" buttons to browse through image sets
2. **View synchronized data**: Observe RGB spatially resolved images alongside their transient intensity maps and line plots
3. **Compare views**: Analyze spatial and temporal information simultaneously across the three synchronized views
#### As an Annotator:
1. **Create bounding boxes**: Click two points on any image (first click = corner 1, second click = opposite corner)
2. **Classify**: Enter class name to assign labels to annotations
3. **Multi-view annotation**: Annotate on RGB spatial view, transient intensity, or line plots - all synchronized
4. **Auto-save**: Annotations automatically save when navigating
5. **Review**: Use auto-play feature for quality assurance
6. **Export**: Export RGB images with bounding boxes and corresponding transient signals for model training
### Auto-Play Usage
1. Click the โถ๏ธ **Play** button (green outline)
2. Enter desired interval (e.g., "3" for 3 seconds between images)
3. Watch the complete dataset cycle through all folders and sets
4. Use โธ๏ธ **Pause** to stop, or click any navigation button to take manual control
### Zoom Controls
- Click **๐+** to zoom in on specific image
- Click **๐-** to zoom out
- Zoom starts at 100% (fit-to-screen)
- Scroll bars appear only when zoomed over 100%
### Reset Options
- **By Folder**: Clear annotations for current folder only
- **By Class**: Clear annotations for specific class across all images
- **Global**: Clear all annotations (use with caution)
## ๐ **Output Format**
Annotations are saved to `out.csv` with the following format:
```csv
image,id,name,centerX,centerY,width,height
toy/object1-sr_int_full.png,1,teddy,150.5,200.3,45.2,67.8
toy/object1-tr_int_full.png,1,teddy,150.5,200.3,45.2,67.8
toy/object1-tr_line.png,1,teddy,150.5,200.3,45.2,67.8
```
Each annotation includes:
- **Image path**: Path to the annotated image (RGB spatial, transient intensity, or line plot)
- **Class ID**: Sequential ID per class
- **Class name**: User-assigned class label
- **Bounding box coordinates**: Center point (centerX, centerY) and dimensions (width, height)
The exported data can be used to:
- Train spatiotemporal object detection models
- Associate RGB spatial information with transient temporal signals
- Create datasets with synchronized spatial and temporal annotations
## ๐ฏ **Advanced Features**
### File ID Grouping
- Images automatically grouped by file ID prefix (everything before first '-')
- Ensures related images stay together in annotation sets
- Maintains data integrity across different image types
### Class-Based ID System
- Each class maintains its own ID sequence
- Example: teddy class gets IDs 1,2,3... while cup class gets separate 1,2,3...
- Prevents ID conflicts between different object types
### Continuous Loop Workflow
- Application never "ends" - automatically loops back to beginning
- Perfect for ongoing annotation projects
- Supports multiple annotation sessions
## ๐ง **Configuration**
The application automatically detects and configures:
- Image folders and valid image sets
- Required image suffixes (`sr_int_full.png`, `-tr_line.png`, `-tr_int_full.png`)
- CSV file location and format
- Navigation state and progress
## ๐ **Notes**
- Only folders containing all three required image types are included
- Images must follow the naming convention: `prefix-suffix.png`
- Auto-save occurs on every navigation action
- Zoom and annotation state is maintained per canvas
- Application supports unlimited classes and annotations
## ๐จ **Design Philosophy**
This tool prioritizes:
- **Efficiency**: Streamlined workflow for rapid annotation
- **Accuracy**: Clear visual presentation and precise controls
- **Consistency**: Standardized format and behavior
- **Usability**: Intuitive interface with professional appearance
- **Quality**: Built-in review and validation features
## ๐ฌ **Use Cases**
### Spatiotemporal Object Detection
- **Visualize** RGB spatially resolved images with their corresponding transient signals
- **Annotate** objects using simple two-point bounding box creation
- **Export** synchronized RGB and transient data for model training
- **Train** spatiotemporal object detection models with both spatial and temporal information
### Research Applications
- Material analysis with spatial and temporal resolution
- Object detection in time-resolved imaging
- Multi-modal dataset preparation
- Spatiotemporal pattern recognition
---
**Built for professional spatiotemporal object detection workflows, combining visualization and annotation capabilities for RGB spatial and transient temporal data.**
|