Skip to content

milliyang/ts_label

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Multi-purpose Time Series Data Labeling Tool

An interactive data labeling tool built with Flask and Plotly following a modern web app architecture. It supports dynamic column detection, multi-dataset management, region selection labeling, time series and event labeling, and visualization/analysis of multiple data types.

🌟 Key Features

  • 🏗️ Modern architecture – Flask application factory pattern, clean structure, easy to extend.
  • 🚀 Auto initialization – Generates example datasets on first run for an out-of-the-box experience.
  • 🔍 Dynamic column detection – Automatically detects CSV columns and generates visualization configs.
  • 📁 Flexible path management – Configure multiple dataset roots (absolute/relative) in config.py.
  • 🎨 Automatic color assignment – Smart, distinct colors for each data column and label.
  • 🎯 Interactive labeling – Region selection and label management; supports index-based and time-based modes.
  • 📊 Multi-dimensional visualization – Display trends of multiple columns for easy comparison.
  • Time series support – Auto-detect time columns and enable calendar-time visualization and labeling.
  • 📈 Stock data support – Built-in visualization for OHLCV-formatted financial data.
  • ⚖️ Smart data processing – Auto-normalization for Volume to improve readability.
  • 🏷️ Rich label system – Labels stored as JSON with support for complex metadata.

📁 Project Structure

The project uses a modular structure, separating core logic from routes for maintainability.

ts_label/
├── app/                          # Flask app core
│   ├── routes/                   # Blueprints
│   │   ├── main.py               #   - main page routes
│   │   └── api.py                #   - API routes
│   ├── services.py               # Business services (e.g., LabelManager)
│   └── __init__.py               # Application factory create_app()
├── dataset/                      # Dataset root (configurable)
│   ├── train/
│   ├── test/
│   ├── val/
│   └── demo/
├── static/                       # Static assets (CSS, JS)
├── templates/                    # HTML templates
├── config.py                     # Configuration (e.g., dataset paths)
├── data.py                       # Data processing and generation
├── run.py                        # App entrypoint
├── requirements.txt              # Python dependencies
└── README.md                     # Project readme

🚀 Quick Start

1. Install dependencies

pip install -r requirements.txt

2. Run the app

python run.py

On startup, if the dataset directory is empty, example data will be generated automatically.

3. Access the app

✨ Main Capabilities

(Feature set mirrors earlier versions but is implemented on a more robust backend.)

🔍 Dynamic column detection

  • Auto detection of all columns in CSV files.
  • Smart formatting of column display names (e.g., wind_speed_1Wind Speed 1).
  • Color palette assignment: up to 10 distinct colors per plot group.

⏰ Time series support

  • Automatic time detection – recognizes common time column names (date, time, timestamp, etc.).
  • Time-axis visualization – sets x-axis type appropriately.
  • Time-based labeling – supports labels based on calendar time ranges.

📈 Stock data support

  • OHLCV format – visualize open, high, low, close, and volume.
  • Technical indicators – auto-computes MA5, MA20 moving averages.
  • Volume normalization – automatically normalizes the Volume column.

🎨 Color palette

Automatically assigns distinct colors to data columns and labels to improve visual separability.

🗂️ Multi-dataset path management

  • Supports configurations for train, test, val, and demo datasets.
  • Quick switching across dataset types.
  • Real-time display of dataset statistics.

📊 Smart data handling

  • Manage multiple dataset files.
  • Generate sample datasets (wind speed, stock, multi-sensor data).
  • Auto-associate data files with corresponding label files.
  • One-click creation of all sample datasets.

🎯 Interactive labeling

  • 🖱️ Drag to select data regions.
  • 🎨 Real-time highlight of selected regions.
  • 🏷️ Custom label names.
  • 📝 Add/Delete/Edit labels (via files).
  • 🔄 Label type compatibility – supports both index-based and calendar-time labels.

💻 User interface

  • 📱 Responsive design with mobile support.
  • 🔧 Toolbar mode switch (select/pan) with shortcuts (s/p).
  • 📋 Dataset info panel.
  • 📊 Real-time status showing current selection range and point count.

Preview Layout

Preview

📊 Data Formats

General CSV format

The system can process CSV files with arbitrary column names. The first column is typically a sequence index or timestamp.

seq,wind_speed_1,wind_speed_2,temperature_1
0,10.5,8.2,22.1
1,11.2,9.1,21.8
...

Stock data format (OHLCV)

Standard OHLCV format with Open, High, Low, Close, Volume.

Date,Open,High,Low,Close,Volume,MA5,MA20,Return_Pct
2020-01-01,100.00,105.20,98.50,103.45,1234567,103.45,103.45,0.00
2020-01-02,103.50,106.80,102.10,105.20,987654,104.32,104.32,1.69
...

Label file format (JSON)

Labels are stored as JSON in the labels directory, paired with each data file. See Label format details for the full schema.

🛠️ Tech Stack

  • Backend: Python, Flask
  • Data processing: pandas, numpy
  • Visualization: Plotly.js
  • Frontend: HTML5, CSS3, JavaScript (ES6+)
  • Architecture: Flask Blueprints, Application Factory

🤝 Contributing

Issues and pull requests are welcome!

📄 Documentation

📄 License

No License

About

a timeseries labeling tools for Yolo1D

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published