Skip to content
This repository was archived by the owner on Jan 27, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[submodule "third_party/Depth-Anything-ONNX"]
path = third_party/Depth-Anything-ONNX
url = https://github.com/fabio-sim/Depth-Anything-ONNX.git
[submodule "third_party/sam2"]
path = third_party/sam2
url = https://github.com/facebookresearch/sam2.git
1 change: 0 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ repos:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
- id: check-merge-conflict

- repo: https://github.com/psf/black
Expand Down
3 changes: 3 additions & 0 deletions data_engine/Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Data Engine

For now we have a POC of the project. Data engine is in progress of development.
118 changes: 118 additions & 0 deletions data_engine/poc/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
# Docker ignore file for SAM2 Data Engine

# Python
__pycache__/
*.py[cod]
*$py.class
*.so
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# Virtual environments
venv/
env/
ENV/
env.bak/
venv.bak/

# Cache directories
cache/
.cache/
*.cache

# IDE and editor files
.vscode/
.idea/
*.swp
*.swo
*~
.DS_Store
Thumbs.db

# Logs
*.log
logs/

# Test files
test_output/
test_config/
.pytest_cache/
.coverage
htmlcov/

# Model files (large)
*.pt
*.pth
*.onnx
*.trt
models/

# Data directories
data/
datasets/
videos/
exports/
projects/

# Docker files (don't copy into container)
Dockerfile*
docker-compose*.yml
.dockerignore

# Git
.git/
.gitignore

# Documentation
docs/
*.md
!README.md

# Temporary files
tmp/
temp/
.tmp/

# OS specific
.DS_Store
Thumbs.db
desktop.ini

# Jupyter
.ipynb_checkpoints/
*.ipynb

# Environment files
.env
.env.local
.env.*.local

# Large media files
*.mp4
*.avi
*.mov
*.mkv
*.wmv
*.webm
*.flv

# Archives
*.zip
*.tar.gz
*.rar
*.7z
89 changes: 89 additions & 0 deletions data_engine/poc/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# SAM2 Data Engine Dockerfile
FROM pytorch/pytorch:2.7.1-cuda12.6-cudnn9-runtime

# Install system dependencies for GUI applications and git
RUN apt-get update && apt-get install -y \
libgl1-mesa-glx \
libglib2.0-0 \
libxrender1 \
libxrandr2 \
libxss1 \
libxcursor1 \
libxcomposite1 \
libasound2 \
libxi6 \
libxtst6 \
libqt5gui5 \
libqt5core5a \
libqt5widgets5 \
qt5-gtk-platformtheme \
libxcb1 \
libxcb-xkb1 \
libxkbcommon-x11-0 \
libxcb-icccm4 \
libxcb-image0 \
libxcb-keysyms1 \
libxcb-randr0 \
libxcb-render-util0 \
libxcb-render0 \
libxcb-shape0 \
libxcb-sync1 \
libxcb-xfixes0 \
libxcb-xinerama0 \
libxcb-xinput0 \
libxcb-cursor0 \
x11-apps \
git \
wget \
&& rm -rf /var/lib/apt/lists/*

# Set working directory
WORKDIR /app

# Clone SAM2 repository
RUN git clone https://github.com/facebookresearch/segment-anything-2.git /app/third_party/sam2

# Copy requirements first for better caching
COPY requirements.txt .

# Install Python dependencies including SAM2
RUN pip install --no-cache-dir -r requirements.txt
RUN cd /app/third_party/sam2 && pip install -e .

# Create models directory and config directory
RUN mkdir -p /app/models /app/.config /app/sam2_models

# Set environment variables for Ultralytics
ENV YOLO_CONFIG_DIR=/app/.config
ENV YOLO_CONFIG_DIR=/app/.config

# Download SAM2 models during build time
RUN python3 -c "\
import sys; \
sys.path.append('/app/third_party/sam2'); \
import os; \
import urllib.request; \
os.makedirs('/app/sam2_models', exist_ok=True); \
checkpoint_urls = { \
'sam2_hiera_tiny.pt': 'https://dl.fbaipublicfiles.com/segment_anything_2/072824/sam2_hiera_tiny.pt', \
'sam2_hiera_small.pt': 'https://dl.fbaipublicfiles.com/segment_anything_2/072824/sam2_hiera_small.pt', \
'sam2_hiera_base_plus.pt': 'https://dl.fbaipublicfiles.com/segment_anything_2/072824/sam2_hiera_base_plus.pt', \
'sam2_hiera_large.pt': 'https://dl.fbaipublicfiles.com/segment_anything_2/072824/sam2_hiera_large.pt' \
}; \
[urllib.request.urlretrieve(url, f'/app/sam2_models/{filename}') for filename, url in checkpoint_urls.items() if not os.path.exists(f'/app/sam2_models/{filename}')]; \
print('All SAM2 models downloaded')"

# Download YOLOv8 models during build time (keeping YOLO for dataset export)
RUN python -c "from ultralytics import YOLO; model = YOLO('yolov8n.pt'); print('YOLOv8 nano model downloaded')"
RUN python -c "from ultralytics import YOLO; model = YOLO('yolov8s.pt'); print('YOLOv8 small model downloaded')"
RUN python -c "from ultralytics import YOLO; model = YOLO('yolov8m.pt'); print('YOLOv8 medium model downloaded')"

# Copy the current directory contents
COPY . .

# Set environment variables for GUI
ENV QT_X11_NO_MITSHM=1
ENV DISPLAY=:0

# Run the main GUI application
CMD ["python", "main.py"]
30 changes: 30 additions & 0 deletions data_engine/poc/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# SAM2 Data Engine - YOLO Dataset Generator

An automatic data engine GUI application that uses visual prompts to interact with SAM2 (Segment Anything Model 2) for generating YOLO training datasets with automatic video segmentation.



This implementation is a POC of the actual data engine that we want to build. It should serve as reference as the type of features we want to have.


### How to run this code?

It has a dockerfile to run the application.

First give access for the docker access the xserver with this command:

```bash
xhost +
```


Then run docker container with compose. Inside the directory run the following command:

```bash
docker compose up
```

You should see the following applicatation running.


![](poc_screenshot.png)
Loading
Loading