A professional image annotation tool based on Vue2, specifically designed for YOLO format data annotation.
- Image Import: Support drag-and-drop upload, multiple image formats (JPG, PNG, GIF, WebP)
- Annotation Drawing: Intuitive rectangular bounding box drawing
- Annotation Editing: Support moving, resizing, and deleting annotation boxes
- Category Management: Configurable annotation categories with color differentiation
- YOLO Export: One-click export to standard YOLO format annotation files
- Keyboard Shortcuts: Rich keyboard shortcuts to improve annotation efficiency
- Zoom View: Support image zooming for precise annotation
- Multi-image Annotation: Batch processing of multiple images
- Category Highlighting: Different categories use different colors for distinction
- Vue2 Architecture: Based on Vue2 + Vuex + Vue Router
- Mock API: Complete Mock data support for development and demonstration
- Modular Design: Clear project structure, easy to maintain and extend
- Responsive Design: Support for different screen sizes
- Integration Ready: Reserved interfaces for main system integration
- Node.js >= 14.0.0
- npm or yarn
npm install
npm run serve
npm run build
-
Start the Project
npm run serve
-
Access the Application
- Open browser and visit
http://localhost:8080
- The system will automatically redirect to the annotation page
- Open browser and visit
-
Start Annotating
- Click "Import Images" to upload images
- Select annotation category
- Draw annotation boxes on the image
- Use keyboard shortcuts to improve efficiency
- Drag and Drop: Drag image files to the upload area
- Click to Select: Click the upload area to select local images
- Supported Formats: JPG, PNG, GIF, WebP
- File Size: Maximum 10MB
- Select annotation category (left panel or use number keys 1-5)
- Enable drawing mode
- Hold left mouse button and drag on the image to draw annotation box
- Release mouse to complete annotation
- Select Annotation: Click annotation box to select
- Move Annotation: Drag annotation box to new position
- Resize: Drag the resize handles on the edges of annotation box
- Delete Annotation: Select and click delete button or press Delete key
Shortcut | Function |
---|---|
1-5 | Select annotation category |
Delete | Delete selected annotation |
Ctrl+S | Save current annotations |
A | Previous image |
D | Next image |
+ | Zoom in |
- | Zoom out |
- Import Images: Upload new images
- Export YOLO: Export current image's annotations in YOLO format
- Reset: Clear all annotations of current image
- Previous/Next: Switch between images
- Zoom In/Out: Adjust image display size
- Reset: Restore original display ratio
- Draw/Select Mode: Switch annotation mode
yolo-image-annotation/
βββ public/ # Static assets
β βββ index.html # Main HTML file
βββ src/
β βββ api/ # API interfaces
β β βββ index.js # Mock API implementation
β βββ components/ # Reusable components
β β βββ AnnotationCanvas.vue # Annotation canvas component
β β βββ ImageUpload.vue # Image upload component
β βββ router/ # Router configuration
β β βββ index.js
β βββ store/ # Vuex state management
β β βββ index.js
β βββ styles/ # Style files
β β βββ global.css
β βββ utils/ # Utility functions
β β βββ yolo.js # YOLO format conversion tools
β βββ views/ # Page components
β β βββ Home.vue # Home page
β β βββ Annotation.vue # Annotation page
β βββ App.vue # Root component
β βββ main.js # Application entry
βββ package.json # Project configuration
βββ vue.config.js # Vue configuration
βββ README.md # Project documentation
{
id: 1, // Annotation ID
categoryId: 0, // Category ID
x: 0.2, // Top-left X coordinate (relative 0-1)
y: 0.3, // Top-left Y coordinate (relative 0-1)
width: 0.3, // Width (relative 0-1)
height: 0.4 // Height (relative 0-1)
}
class_id x_center y_center width height
Example:
0 0.350000 0.500000 0.300000 0.400000
1 0.600000 0.250000 0.200000 0.300000
Modify category configuration in src/store/index.js
:
categories: [
{ id: 0, name: 'Person', color: '#ff6b6b' },
{ id: 1, name: 'Car', color: '#4ecdc4' },
{ id: 2, name: 'Animal', color: '#45b7d1' },
{ id: 3, name: 'Building', color: '#96ceb4' },
{ id: 4, name: 'Other', color: '#feca57' }
]
Mock API is located in src/api/index.js
, includes:
getImageList()
: Get image listgetAnnotations(imageId)
: Get annotation datasaveAnnotations(imageId, annotations)
: Save annotation datauploadImage(file)
: Upload imageexportYOLO(imageIds)
: Export YOLO format
The project can run directly as a standalone application with npm run serve
.
- Component Integration: Import
Annotation.vue
component into the main system - API Replacement: Replace Mock API with real backend interfaces
- Router Integration: Integrate route configuration into main system router
All API calls go through src/api/index.js
module. When replacing:
- Modify API base configuration
- Update interface implementation
- Keep data format consistent
- Add category definition in Vuex store
- Update color configuration
- Update keyboard shortcut mapping (if needed)
- Modify
AnnotationCanvas.vue
component - Update data structure
- Adjust YOLO export logic
- Global styles:
src/styles/global.css
- Component styles:
<style>
sections in each component - Theme configuration:
vue.config.js
GET /api/images
- Get image listPOST /api/images
- Upload imageDELETE /api/images/:id
- Delete image
GET /api/annotations/:imageId
- Get image annotationsPOST /api/annotations/:imageId
- Save annotation dataPOST /api/export/yolo
- Export YOLO format
- Fork the project
- Create a feature branch (
git checkout -b feature/AmazingFeature
) - Commit your changes (
git commit -m 'Add some AmazingFeature'
) - Push to the branch (
git push origin feature/AmazingFeature
) - Create a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details
- Vue.js - Progressive JavaScript Framework
- Element UI - Excellent Vue Component Library