Skip to main content

TouchLabel AI - Tactile Data Annotation Toolkit

Project description

TouchLabel AI ๐Ÿฆž

Sensor-Agnostic Tactile Data Annotation Toolkit

load โ†’ review โ†’ export ยท Three steps to close the loop

PyPI Python License ไธญๆ–‡ๆ–‡ๆกฃ

TouchLabel AI Panel Demo


๐Ÿš€ Quick Start

pip install tlabel
import tlabel

# 1๏ธโƒฃ Load โ€” auto-detect sensor format
data = tlabel.load("gelsight_force.pkl")     # GelSight / DIGIT
data = tlabel.load("paxini_episode.h5")      # PaXini
data = tlabel.load("daimon_data/")           # Daimon (directory or .parquet)

# 2๏ธโƒฃ Annotate โ€” interactive Jupyter panel
data.review()          # Chinese UI
data.review(lang="en") # English UI

# 3๏ธโƒฃ Export
data.export("output.json")   # TLabel Format v2 JSON
data.export("output.csv")    # CSV flat table
๐Ÿ“ฅ Try with demo data
pip install tlabel
python -c "
import json, urllib.request
from tlabel.core.types import TLabelFrame, TLabelData

url = 'https://raw.githubusercontent.com/liesliy/tlabel/main/examples/data/demo_gelsight.json'
raw = json.loads(urllib.request.urlopen(url).read())
frames = [TLabelFrame(f['frame_idx'], f['timestamp_s'], f['tlabel_v2'], f.get('manipulation_phase','idle'), f.get('confidence',1.0)) for f in raw['frames']]
data = TLabelData(frames, raw['sensor'], raw['episode'], raw['capabilities'])
data.review()
"

๐Ÿ“ก Supported Sensors

Sensor Format Dimensions Optical Flow Status
GelSight Mini .pkl 22 โœ… โœ… Stable
DIGIT .pkl 22 โœ… โœ… Stable
Daimon DM-TacClaw .parquet / dir 22 (video) / 20 (no video) โœ… / โ€” โœ… Stable
PaXini PXCap .h5 / .hdf5 20 โ€” โœ… Stable

Force-type sensors (PaXini) lack optical images and don't support optical flow features, yielding 20 dimensions. Image-type sensors output all 22 dimensions. Daimon gracefully degrades to 20 dims when no video file is present.


๐Ÿ“ฆ Installation

# Minimal (numpy only)
pip install tlabel

# Per-sensor optional dependencies
pip install tlabel[gelsight]   # GelSight / DIGIT โ†’ opencv-python
pip install tlabel[paxini]     # PaXini โ†’ h5py
pip install tlabel[daimon]     # Daimon โ†’ pyarrow + opencv-python

# Everything
pip install tlabel[all]

๐ŸŽจ Panel Features

  • ๐ŸŽจ Color-coded timeline: green = contact ยท red = slip ยท gray = no contact
  • ๐Ÿ•ธ 22-dim radar chart: full TLabel Format v2 visualization with bilingual labels
  • โœ๏ธ Frame & batch patching: select a range, modify in one click
  • ๐Ÿ”— Cascade rules: setting contact=0 auto-zeroes 7 related fields + resets manipulation_phaseโ†’idle
  • ๐ŸŒ Bilingual toggle: Chinese / English, one click in the top-right corner
  • ๐Ÿ“ค Export: JSON / CSV, auto-detected by file extension

TLabel Format v2 โ€” 22 Dimensions

Static Features (18-dim)

# Key Description
1 contact Binary contact flag
2 deformation_magnitude Surface deformation intensity
3 force_magnitude Normal force magnitude
4 force_peak Peak force in episode window
5 force_direction Force vector angle (ยฐ)
6 slip_entropy Uncertainty of slip detection
7 slip_event Binary slip event flag
8 texture_energy Surface texture frequency energy
9 edge_density Contact edge pixel ratio
10 contact_area Contact region area ratio
11 centroid_x Contact centroid x-position
12 normal_field_magnitude Normal pressure field magnitude
13 normal_field_variance Normal field spatial variance
14 shear_field_magnitude Shear stress magnitude
15 shear_field_direction Shear direction angle (ยฐ)
16 delta_force_normal Frame-to-frame ฮ”F_normal
17 delta_force_shear Frame-to-frame ฮ”F_shear
18 friction_cone_ratio Tangential/normal force ratio

Temporal Features (4-dim, v0.2.0)

# Key Image-type Force-type Description
19 optical_flow_magnitude โœ… โ€” Inter-frame motion magnitude (Farneback)
20 optical_flow_direction โœ… โ€” Optical flow angle (ยฐ)
21 temporal_deformation_rate โœ… โœ… Rate of deformation change
22 contact_transition โœ… โœ… Contact state transition probability

๐Ÿ“– API Quick Reference

import tlabel

# โ”€โ”€ Loading โ”€โ”€
data = tlabel.load(path)                     # Auto-detect sensor format
data = tlabel.load(path, format="gelsight")  # Force specific adapter

# โ”€โ”€ Properties โ”€โ”€
data.num_frames        # int โ€” total frame count
data.duration_s        # float โ€” episode duration
data.sensor_type       # str โ€” sensor identifier
data.dimension_keys    # list โ€” all dimension keys for this sensor
data.modified_count    # int โ€” frames with manual patches

# โ”€โ”€ Frame Access โ”€โ”€
frame = data[0]                          # Index access
frame = data.get_frame(42)               # By frame_idx
frame.contact                            # Contact value
frame.slip_event                         # Slip event value
frame.is_modified                        # Has patches?

# โ”€โ”€ Patching โ”€โ”€
frame.patch("contact", 0)                         # Single frame (cascade=True)
frame.patch("contact", 0, cascade=False)           # No cascade
data.batch_patch(10, 50, "contact", 0)             # Range patch

# โ”€โ”€ Review & Export โ”€โ”€
data.review()                    # Jupyter panel (Chinese)
data.review(lang="en")           # English
data.export("output.json")       # JSON (TLabel Format v2)
data.export("output.csv")        # CSV

Cascade Rules (contact โ†’ 0)

When contact is set to 0, these fields are automatically zeroed:

Auto-zeroed Field Condition
force_magnitude always
force_peak always
slip_event always
delta_force_normal always
delta_force_shear always
contact_area always
contact_transition only if value > 0.5
manipulation_phase โ†’ "idle" (if not already)

๐Ÿ—‚ Project Structure

tlabel/
โ”œโ”€โ”€ core/
โ”‚   โ”œโ”€โ”€ types.py          # TLabelFrame / TLabelData containers
โ”‚   โ”œโ”€โ”€ loader.py         # Auto-detect & dispatch loading
โ”‚   โ””โ”€โ”€ registry.py       # Adapter registry
โ”œโ”€โ”€ adapters/
โ”‚   โ”œโ”€โ”€ base.py           # BaseAdapter interface
โ”‚   โ”œโ”€โ”€ gelsight.py       # GelSight Mini / DIGIT
โ”‚   โ”œโ”€โ”€ paxini.py         # PaXini PXCap
โ”‚   โ””โ”€โ”€ daimon.py         # Daimon DM-TacClaw (+ video decoding)
โ”œโ”€โ”€ viewer/
โ”‚   โ”œโ”€โ”€ panel.py          # Jupyter _repr_html_ renderer
โ”‚   โ””โ”€โ”€ templates.py      # HTML + JS + CSS template engine
โ””โ”€โ”€ export/
    โ””โ”€โ”€ writer.py         # JSON / CSV export + NumpyEncoder

๐Ÿค Contributing

We welcome contributions! See CONTRIBUTING.md for guidelines.

Good first issues:

  • ๐Ÿ”Œ Add a new sensor adapter (e.g., SynTouch, XELA)
  • ๐Ÿ“Š Improve radar chart UI (dark mode, interactive hover)
  • ๐ŸŒ Add more language support (ๆ—ฅๆœฌ่ชž, ํ•œ๊ตญ์–ด)
  • ๐Ÿงช Add integration tests for edge cases

๐Ÿ“„ License

MIT ยฉ Niuzu Tech


Star us โญ if it helps your research!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tlabel-0.2.0a3.tar.gz (42.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tlabel-0.2.0a3-py3-none-any.whl (43.7 kB view details)

Uploaded Python 3

File details

Details for the file tlabel-0.2.0a3.tar.gz.

File metadata

  • Download URL: tlabel-0.2.0a3.tar.gz
  • Upload date:
  • Size: 42.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for tlabel-0.2.0a3.tar.gz
Algorithm Hash digest
SHA256 755d8f4d7148c7e292b9bab45e8caed5f21bfc1d5b2cc5ea327f61cd8c836b41
MD5 704054f7f2611bcb00ee0d34348d54d9
BLAKE2b-256 f7a9173b19d6330d32492009a198e0ba3a0158c72878aaffbac608a8d64a0adc

See more details on using hashes here.

File details

Details for the file tlabel-0.2.0a3-py3-none-any.whl.

File metadata

  • Download URL: tlabel-0.2.0a3-py3-none-any.whl
  • Upload date:
  • Size: 43.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for tlabel-0.2.0a3-py3-none-any.whl
Algorithm Hash digest
SHA256 7148b2fbb373c159220bc1cbd7f8e33b89b4340865bf8233fe42f37d9944dd50
MD5 7cd1e962ef8c4ff97b6737cba2ae090d
BLAKE2b-256 bef75fca99f57d68c1ac27a4099d016ff965be20f3f3aaf78a7e6508e6673094

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page