# Cars object detection — Data

来源：https://www.kaggle.com/competitions/cars-object-detection/data

采集时间：2026-10-19T09:00:16Z

This dataset is structured for an object detection task. The dataset includes three files. The annotations are in YOLO (You Only Look Once) format.

### Files Provided

1. **train.zip**
   - Contains two directories:
     - `train/images`: This directory contains the JPEG images for training.
     - `train/labels`: This directory contains corresponding YOLO format label files for the training images. Each label file shares the same name as its corresponding image and includes annotations.

2. **test.zip**
   - Contains one directory:
     - `test/images`: This directory contains the JPEG images for testing. These images are used to evaluate the final model predictions in the competition.

3. **sample_submission.csv**
   - A sample submission file in the correct format that participants should use as a template for submitting their predictions.

### Data Format in Labels

Each label file in the `train/labels` directory contains annotations for the corresponding image in the `train/images` directory. The format for each annotation within the label files is as follows:
- **class_id**: An integer representing the category of the object. The problem has only one class, so the value is always 0.
- **center_x**: The x-coordinate of the center of the object, normalized by the image width (0 to 1).
- **center_y**: The y-coordinate of the center of the object, normalized by the image height (0 to 1).
- **width**: The width of the object, normalized by the image width (0 to 1).
- **height**: The height of the object, normalized by the image height (0 to 1).

Here’s an example of what the content of a label file might look like:
```
0 0.512 0.469 0.230 0.320
0 0.230 0.350 0.120 0.156
```
In this example, each line corresponds to a different object within the image. The first number is the class ID, followed by the normalized center coordinates, width, and height of the object's bounding box.

### Explanation of `sample_submission.csv` Format

The `sample_submission.csv` file provides a format guide for submitting the predictions of the object detection model.

**File Structure**

The `sample_submission.csv` contains two columns:

1. **id**: This is the identifier corresponding to the filename of an image from the `test/images` directory in the `test.zip` file. The ID should be the filename without the '.jpg' extension.
   
2. **predictions**: This column contains the predicted annotations for each image, formatted as *List*. Each prediction in the *List* consists of several components related to the detected objects in the image, formatted as follows:
   - **class_id**: The predicted class identifier for the object.
   - **confidence**: The confidence score of the detection.
   - **center_x**: The normalized x-coordinate of the center of the bounding box.
   - **center_y**: The normalized y-coordinate of the center of the bounding box.
   - **width**: The normalized width of the bounding box.
   - **height**: The normalized height of the bounding box.

Here is the format for each prediction entry in the `predictions` column:
```
[class_id, confidence, center_x, center_y, width, height, class_id, confidence, center_x, center_y, width, height]
```

**Example Entry**

Suppose an image with ID '3ee1ee02-GOPR6568' from the test set has two objects detected. And image with ID 'aece3643-GOPR6651' from the test set has no objects detected. The `sample_submission.csv` entry might look like this:

```csv
id, predictions
3ee1ee02-GOPR6568,"[0, 0.78, 0.44732, 0.91217, 0.01795, 0.02063, 0, 1.0, 0.81899, 0.78349, 0.02522, 0.01389]"
aece3643-GOPR6651,[]
```
In this example:
- The first object detected is of class 0 with a confidence of 0.78. Its bounding box center is at (0.44732, 0.91217) with a width of 0.01795 and a height of 0.02063.
- The second object is of class 0 with a confidence of 1.0, with the center of its bounding box at (0.81899, 0.78349), and dimensions of 0.02522 in width and 0.01389 in height.

**Important Notes**

- class_id is always 0
- Ensure that `center_x`, `center_y`, `width`, and `height` are normalized values relative to the dimensions of the respective image. 
- Confidence scores should be between 0 and 1, where 1 indicates the highest confidence.
