Labelme
ProductsExamplesStoryPricingDocumentation
Sign in
  • Installation
  • Install Labelme as App
  • Install Labelme using Terminal
  • Install Labelme using Terminal (old way)
  • Install Labelme Toolkit
  • Troubleshoot
  • All released versions
  • Toolkit Docs
  • ai-annotate-rectangles
  • ai-rectangle-to-mask
  • export-to-voc
  • export-to-yolo
  • extract-image
  • import-from-yolo
  • json-to-mask
  • json-to-masks
  • json-to-visualization
  • list-labels
  • print-stats
  • rename-labels
  • resize-image
  • Starter Guide
  • 1. Annotate image with Labelme
  • 2. Open and edit annotated file
  • 3. Load annotated file with Python
  • 4. Export annotated file to PNG
  • 5. Load exported files with Python
  • Dataset Guide
  • 1. Download real dataset
  • 2. Verify dataset visually
  • 3. Verify dataset statistically
  • 4. Additional data collection
  • 5. Export dataset
  • Bonus: PyTorch dataset class

Bonus: PyTorch dataset class

You need to be a Pro member to access the full content of this.

Write PyTorch dataset class

In PyTorch, the Dataset class is a useful abstraction that allows you to work with a large amount of data. To create a class for your own data, you need to define a class that inherits from torch.utils.data.Dataset.


Let’s write the one for amazon-picking-challenge-2016 dataset we created in Export dataset.


Here is the base structure:

If you're a Pro member, sign in 🔒️ to read the rest of the guide. Or check our plans if you don't have them yet.

  • Write PyTorch dataset class
  • Verify the dataset class
  • Train your model