top of page


Public·21 members

Cars196: A Large-Scale Dataset of Car Images with Bounding Boxes and Labels

Cars196 Dataset: A Comprehensive Guide

If you are interested in fine-grained image classification and retrieval, you might have heard of the Cars196 dataset. This dataset contains 16,185 images of 196 classes of cars, ranging from common models to rare and exotic ones. It is widely used as a benchmark for deep metric learning, a branch of machine learning that aims to learn meaningful distance metrics between data points.

cars196 dataset download

Download Zip:

In this article, we will provide a comprehensive guide to the Cars196 dataset, covering its description, features, source, citation, download, usage, applications, and challenges. We will also show you how to load and explore the dataset with TensorFlow Datasets, a library that provides easy access to various datasets for machine learning. By the end of this article, you will have a better understanding of the Cars196 dataset and how to use it for your own projects.

What is the Cars196 Dataset?

The Cars196 dataset was introduced by Jonathan Krause et al. in their paper "3D Object Representations for Fine-Grained Categorization" , which was presented at the 4th International IEEE Workshop on 3D Representation and Recognition (3dRR-13) in 2013. The paper proposed a novel approach to represent 3D objects using a collection of 2D views, and applied it to fine-grained categorization of cars.

Description and features

The Cars196 dataset contains 16,185 images of 196 classes of cars . The data is split into 8,144 training images and 8,041 testing images, where each class has been split roughly in a 50-50 split. Classes are typically at the level of Make, Model, Year, e.g. 2012 Tesla Model S or 2012 BMW M3 coupe.

The dataset also provides bounding boxes for each image, which indicate the location of the car in the image. The bounding boxes are given as four coordinates (x_min, y_min, x_max, y_max) in pixels. Additionally, the dataset provides an ID for each image, which is a unique identifier that can be used to reference the image.

The dataset has the following features:

  • Image: An image of a car in JPEG format with variable size and color depth.

  • Bbox: A bounding box for the car in the image as a tuple of four floats.

  • ID: An ID for the image as a string.

  • Label: A label for the car class as an integer between 0 and 195.

Source and citation

The Cars196 dataset was created by Jonathan Krause et al. from Stanford University . The images were collected from various sources on the internet, such as Google Images, Flickr, and car forums. The authors manually annotated the images with bounding boxes and labels.

The dataset is hosted on the Stanford AI Lab website , where you can find more information about the dataset, such as sample images, class names, statistics, and download links. You can also find the source code for loading and processing the dataset with MATLAB .

cars196 dataset tensorflow

cars196 dataset kaggle

cars196 dataset github

cars196 dataset license

cars196 dataset multiclass classification

cars196 dataset images

cars196 dataset 16,185 images

cars196 dataset 196 classes

cars196 dataset make model year

cars196 dataset 2012 Tesla Model S

cars196 dataset 2012 BMW M3 coupe

cars196 dataset split

cars196 dataset train test

cars196 dataset 50-50 split

cars196 dataset download link

cars196 dataset download size

cars196 dataset download zip

cars196 dataset download csv

cars196 dataset download tfds

cars196 dataset download api

cars196 dataset citation

cars196 dataset papers with code

cars196 dataset know your data

cars196 dataset visualization

cars196 dataset feature structure

cars196 dataset feature documentation

cars196 dataset supervised keys

cars196 dataset figure

cars196 dataset examples

cars196 dataset as_dataframe

cars196 dataset data card

cars196 dataset code

cars196 dataset discussion

cars196 dataset usability info

cars196 dataset tags

cars196 dataset feedback

cars196 dataset metadata

cars196 dataset source code

cars196 dataset versions

cars196 dataset auto-cached

cars196 dataset splits

cars196 dataset bbox feature

cars196 dataset id feature

cars196 dataset image feature

cars196 dataset label feature

cars196 dataset class label featuredict

If you use the Cars196 dataset for your research or project, please cite the following paper:

@inproceedings{KrauseStarkDengFei-Fei_3DRR2013, title = 3D Object Representations for Fine-Grained Categorization, booktitle = 4th International IEEE Workshop on 3D Representation and Recognition (3dRR-13), year = 2013, address = Sydney, Australia, author = Jonathan Krause and Michael Stark and Jia Deng and Li Fei-Fei

How to Download and Use the Cars196 Dataset?

Now that you know what the Cars196 dataset is and where it comes from, you might be wondering how to download and use it for your own projects. There are two main ways to do this: downloading the dataset directly from the Stanford AI Lab website, or loading the dataset with TensorFlow Datasets.

Downloading the dataset

The easiest way to download the Cars196 dataset is to visit the Stanford AI Lab website and click on the "Download Dataset" button. This will download a ZIP file named "car_ims.tgz" that contains all the images in the dataset. The file size is about 1.8 GB, so it might take some time depending on your internet speed.

After downloading the ZIP file, you need to extract it to a folder of your choice. You can use any tool that can handle ZIP files, such as WinZip, 7-Zip, or the built-in Windows or Mac OS utilities. The extracted folder will contain 16,185 JPEG files named with their IDs, such as "000001.jpg", "000002.jpg", etc.

You also need to download two text files that contain the bounding boxes and labels for each image. These files are named "cars_annos.mat" and "cars_test_annos_withlabels.mat", and they can be found on the same website . You need to place these files in the same folder as the images.

Alternatively, you can use the following commands to download and extract the dataset from a terminal or command prompt:

wget tar -xvzf car_ims.tgz wget wget

Loading the dataset with TensorFlow Datasets

If you are using TensorFlow as your machine learning framework, you can also load the Cars196 dataset with TensorFlow Datasets (TFDS) , a library that provides easy access to various datasets for machine learning. TFDS handles downloading, extracting, splitting, shuffling, and batching the data for you, so you can focus on building your model.

To use TFDS, you need to install it first with the following command:

pip install tensorflow-datasets

Then, you can import it in your Python script along with TensorFlow:

import tensorflow as tf import tensorflow_datasets as tfds

To load the Cars196 dataset with TFDS, you can use the following code:

(train_ds, test_ds), ds_info = tfds.load('cars196', split=['train', 'test'], shuffle_files=True, with_info=True)

This will download and load the dataset as two objects: train_ds and test_ds. These objects are iterable and can be used to feed your model with data. The ds_info object contains useful information about the dataset, such as its name, version, features, size, splits, citation, etc.

You can also specify other parameters for tfds.load(), such as download=False if you have already downloaded the dataset manually, or as_supervised=True if you want to get the data as (image, label) pairs instead of dictionaries. For more details on how to use TFDS, please refer to the official documentation .

Exploring the dataset with visualization and statistics

Before using the Cars196 dataset for your machine learning tasks, it is a good idea to explore it with some visualization and statistics. This can help you understand the data better and identify any potential issues or challenges.

One way to visualize the dataset is to use matplotlib , a popular Python library for plotting and graphing. You can use matplotlib to display some sample images from the dataset along with their labels and bounding boxes. For example, you can use the following code to plot 9 random images from the train_ds object:

import matplotlib.pyplot as plt import numpy as np # Get 9 random images from train_ds images = [] labels = [] bboxes = [] for image_dict in train_ds.take(9): images.append(image_dict['image']) labels.append(image_dict['label']) bboxes.append(image_dict['bbox']) # Plot images in a 3x3 grid fig, axes = plt.subplots(3, 3, figsize=(10, 10)) for i, ax in enumerate(axes.flat): # Get image, label, and bbox image = images[i].numpy() label = labels[i].numpy() bbox = bboxes[i].numpy() # Draw bbox on image x_min, y_min, x_max, y_max = bbox image = cv2.rectangle(image, (x_min, y_min), (x_max, y_max), (255, 0, 0), 2) # Show image and label ax.imshow(image) ax.set_title(f'Class: label')

This will produce a plot like this:

Another way to explore the dataset is to use pandas , a popular Python library for data analysis and manipulation. You can use pandas to create a data frame that contains the ID, label, and bounding box for e


Welcome to the group! You can connect with other members, ge...
Group Page: Groups_SingleGroup
bottom of page