File size: 2,113 Bytes
ba37ef7
3450062
ba37ef7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# **VOC2012 Image and Annotation Visualization** Notebook

**Github**: https://github.com/ikaankeskin/MLXdatasets/tree/main/ObjectDetection/PASCAL

**HuggingFace**: https://huggingface.co/datasets/ikaankeskin/PASCAL_MLX

This repository contains a tool that facilitates the download, extraction, and visualization of the VOC2012 dataset, complete with bounding box annotations extracted from associated XML files.

## **Features**

- **Automated Dataset Download**: Fetches the VOC2012 dataset from Hugging Face's repository in ZIP format.
- **ZIP Extraction**: Conveniently unzips the downloaded dataset to provide access to images and their annotations.
- **Image Visualization**: Displays a select set of images from the dataset for preliminary visualization.
- **XML Annotation Processing**: Reads corresponding XML annotation files for chosen images.
- **Bounding Box Overlay**: Draws bounding boxes around annotated objects on the images, enhancing visualization.
- **Annotation Table Display**: Offers a structured view of extracted details from XML annotations in tabular format.


```

- **Python**: Version 3.x
- **Libraries**: As specified in **`requirements.txt`**, which includes:
    - requests
    - tqdm
    - pandas
    - matplotlib
    - opencv-python

## **Object Filters for Visualizations**

The tool comes equipped with a specific color mapping that governs the visual representation of certain objects when overlaying bounding box annotations on images. The current mapping is coded as:

```python
color_mapping = {'train': (0, 255, 0), 'person': (0, 0, 255)}
```

This implies:

- 'train' objects are rendered with **green** bounding boxes (RGB: **`(0, 255, 0)`**).
- 'person' objects are visualized with **blue** bounding boxes (RGB: **`(0, 0, 255)`**).

Objects not included in this mapping will not receive bounding boxes during visualization. For incorporating additional object types or altering existing color configurations, users can edit or extend the **`color_mapping`** dictionary. For instance, to visualize 'car' objects in red, an entry **`'car': (255, 0, 0)`** can be added.