Skip to content

antonemking/capra10k

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

23 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Capra10k - Goat Detection Dataset & Labeling Tool ๐Ÿ

A comprehensive tool for creating labeled datasets of goat behavior and detection in agricultural environments. Built by Capra AI for advancing computer vision in livestock management.

๐ŸŽฏ Project Overview

Capra10k aims to create a large-scale, high-quality dataset for:

  • Goat Detection: Individual animal identification and tracking
  • Behavior Analysis: Understanding goat interactions with environment
  • Agricultural AI: Supporting smart farming and livestock management
  • Research: Enabling academic and commercial research in animal AI

โœจ Features

  • Interactive Polygon Labeling: Precise annotation tool for complex shapes
  • Multi-Category Support: Goats, troughs, platforms, and enrichment items
  • Batch Processing: Navigate through large image datasets efficiently
  • Keyboard Shortcuts: Speed up annotation workflow
  • Quality Control: Built-in review system for label validation
  • Export Capabilities: Generate masks and overlays for training

๐Ÿš€ Quick Start

Prerequisites

  • Node.js 14+
  • Modern web browser
  • Images to label (or use our sample dataset)

Installation

git clone https://github.com/yourusername/capra10k.git
cd capra10k
npm install
npm start

Open http://localhost:3000 and start labeling!

For Contributors

See CONTRIBUTING.md for detailed instructions on:

  • Getting image datasets
  • Labeling guidelines
  • Contributing your work
  • Handling large files

๐ŸŒ Deployment (Vercel)

Prerequisites

  1. A Vercel account (free tier works great!)
  2. Vercel Blob Storage connected to your project

Deployment Steps

  1. Install Vercel CLI (optional, for local testing):

    npm install -g vercel
  2. Connect to Vercel:

    • Go to vercel.com and sign in with GitHub
    • Import your repository (antonemking/capra10k)
    • Configure the project with these settings:
      • Framework Preset: Other
      • Root Directory: ./ (or leave blank)
      • Build Command: Leave empty
      • Install Command: npm install
      • Output Directory: Leave empty
  3. Set up Vercel Blob Storage:

    • In your Vercel project dashboard, go to Storage
    • Add Blob Storage
    • Copy the BLOB_READ_WRITE_TOKEN environment variable (this is automatically added to your project)
  4. Upload Images to Blob Storage:

    • Images should be stored with the prefix goat_images/
    • You can upload images via:
      • Vercel Dashboard UI
      • Vercel CLI: vercel blob upload <file> --token <your-token>
      • Custom upload script using the @vercel/blob SDK
  5. Deploy:

    vercel deploy --prod

Environment Variables

The following environment variable is required and automatically configured when you add Blob Storage:

  • BLOB_READ_WRITE_TOKEN - Vercel Blob Storage access token

Image Upload Example

// Upload script example (Node.js)
const { put } = require('@vercel/blob');

async function uploadImage(filePath) {
  const fileBuffer = require('fs').readFileSync(filePath);
  const blob = await put(`goat_images/${path.basename(filePath)}`, fileBuffer, {
    access: 'public',
    token: process.env.BLOB_READ_WRITE_TOKEN,
  });
  console.log('Uploaded:', blob.url);
}

Important Notes

  • Blob Storage Structure:
    • goat_images/ - Source images to label
    • goat_images_need_review/ - Completed annotations
    • goat_images_reviewed/ - Final approved labels
  • All images are stored in Vercel Blob Storage with public URLs
  • The frontend automatically loads images from blob URLs
  • Annotations are saved directly to blob storage

๐Ÿท๏ธ Annotation Categories

Category Description Color
๐Ÿ Goat Individual goat bodies Red
๐Ÿฝ๏ธ Trough Feeding and water areas Green
๐Ÿชœ Platform Elevated structures, ramps Brown
๐ŸŽพ Enrichment Toys, play objects Purple

๐ŸŽฎ Controls & Shortcuts

Mouse Controls

  • Click: Place annotation points
  • Click near start: Close polygon
  • Drag points: Adjust polygon shape
  • Right-click point: Delete point
  • Scroll: Zoom in/out

Keyboard Shortcuts

  • โ†/โ†’: Navigate between images
  • 1-4: Quick category selection
  • Ctrl+S: Save & move to next
  • Space: Skip current image
  • Esc: Reset annotations
  • Z/Y: Undo/Redo points

๐Ÿ“ File Structure

capra10k/
โ”œโ”€โ”€ index.html              # Main labeling interface
โ”œโ”€โ”€ server.js               # Express server
โ”œโ”€โ”€ package.json            # Dependencies
โ”œโ”€โ”€ organize-images.js      # Utility for managing image structures
โ”œโ”€โ”€ sample_images/          # Small test images
โ”œโ”€โ”€ CONTRIBUTING.md         # Contributor guide
โ””โ”€โ”€ README.md              # This file

# Created during use (excluded from Git):
โ”œโ”€โ”€ goat_images/           # Source images to label
โ”‚   โ””โ”€โ”€ 2025/05/25/       # Optional: date-organized structure
โ”œโ”€โ”€ goat_images_need_review/  # Completed work for review
โ””โ”€โ”€ goat_images_reviewed/  # Final approved dataset

Image Organization

The tool supports both flat and date-organized directory structures:

# For date-organized images, flatten for labeling
node organize-images.js flatten
npm start

# Restore original structure when done
node organize-images.js restore

๐Ÿค Contributing

We welcome contributions! The project handles large image files through:

  1. Git exclusion: Images are not stored in the repository
  2. S3 distribution: Large datasets available via cloud storage
  3. Flexible workflow: Multiple contribution methods for different scales

See CONTRIBUTING.md for complete details.

๐Ÿ“Š Dataset Progress

  • ๐ŸŽฏ Target: 10,000+ labeled images
  • ๐Ÿ“ˆ Current: [Auto-updated]
  • ๐Ÿ‘ฅ Contributors: [Community count]
  • ๐Ÿท๏ธ Categories: 4 annotation types

๐Ÿ› ๏ธ Technical Details

Built With

  • Frontend: Vanilla JavaScript + Konva.js for canvas manipulation
  • Backend: Node.js + Express for file handling
  • Storage: Vercel Blob Storage for cloud deployment, Local filesystem for development

API Endpoints

  • GET /api/images - List available images (returns array of {filename, url})
  • POST /api/save-overlay - Save annotated overlay to blob storage
  • POST /api/move-to-reviewed - Move image to review queue in blob storage

๐Ÿ“œ License

[Your chosen license here]

๐Ÿ† Acknowledgments

  • Contributors to the dataset
  • Agricultural research community
  • Open source computer vision tools

๐Ÿ“ž Contact


Built with โค๏ธ by Capra AI for the future of agricultural technology

About

10k crowdsourced images for training segnets

Resources

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •