The Comprehensive Cars (CompCars) dataset - 车辆精细识别数据集 - surveillance-nature images
surveillance-nature images - 车辆颜色标注解析
(1) The surveillance data are released as “sv_data.*”.
(2) sv_data.zip -> 解压到当前文件夹 -> sv_data
(3) directory
test_surveillance.txt
train_surveillance.txt
README
This part of data is the surveillance-nature data in the CompCars dataset.
(http://mmlab.ie.cuhk.edu.hk/datasets/comp_cars/index.html)
If you use the dataset in your work, please cite our CVPR 2015 paper:
A Large-Scale Car Dataset for Fine-Grained Categorization and Verification
Descriptions of the files are as follows:
-
image:
Stores all car images in the path format ‘surveillance_model_id/image_name.jpg’. -
color_list.mat:
A MATLAB cell matrix containing all color annotations for each image. Each row is the annotation for one image with the first element being the path of the image and the second element being the color id. The meaning of the color ids are: -1 - unrecognized, 0 - black, 1 - white, 2 - red, 3 - yellow, 4 - blue, 5 - green, 6 - purple, 7 - brown, 8 - champagne, 9 - silver. -
sv_make_model_name.mat:
A MATLAB cell matrix containing make and model names for each ‘surveillance_model_id’. For one ‘surveillance_model_id’, sv_make_model_name{surveillance_model_id,1} and sv_make_model_name{surveillance_model_id,2} are the corresponding make and model name. sv_make_model_name{surveillance_model_id,3} is the ‘model_id’ of the same model in the web-nature data. For each model in the surveillance data, there is a same model in the web-nature data. -
train_surveillance.txt, test_surveillance.txt:
The train/test splits for the fine-grained classification experiments on surveillance data described in -
the updated arXiv paper:
A Large-Scale Car Dataset for Fine-Grained Categorization and Verification
data_preprocessing
CompCars/data_preprocessing
mat_file_color_list.py
mat_file_color_list.py
color_list.mat
#
# Created by foreverstrong on 12/27/2018
#
# !python
# !/usr/bin/env python
'''python
Each row is the annotation for one image with the first element being the path of the image and the second element being the color id.
The meaning of the color ids are:
-1 - unrecognized, 0 - black, 1 - white, 2 - red, 3 - yellow, 4 - blue, 5 - green, 6 - purple, 7 - brown, 8 - champagne, 9 - silver.
'''
from scipy.io import loadmat
import shutil
import os
color_classes = ["black", "white", "red", "yellow", "blue", "green", "purple", "brown", "champagne", "silver"]
sv_data_image_directory = "./sv_data/image"
color_list_mat_file = "./sv_data/color_list.mat"
sv_color_data = "./sv_color_data"
def recursive_directory_creation_function(sv_color_data, color_classes):
for color_name in color_classes:
color_name_directory = sv_color_data + '/' + color_name
if not os.path.exists(color_name_directory):
os.makedirs(color_name_directory)
def main(color_classes, sv_data_image_directory, color_list_mat_file, sv_color_data):
color_list_mat = loadmat(color_list_mat_file)
print(color_list_mat["__version__"])
print(color_list_mat["__header__"])
print(color_list_mat["__globals__"])
color_list_array = color_list_mat["color_list"]
print(len(color_list_array))
recursive_directory_creation_function(sv_color_data, color_classes)
for color_list_element in color_list_array:
image_name = str(color_list_element[0][0])
color_index = int(color_list_element[1][0][0])
if color_index <= -1:
continue
if color_index > 9:
continue
image_file = sv_data_image_directory + '/' + image_name
if os.path.exists(image_file):
image_file_dir = sv_color_data + '/' + color_classes[color_index]
shutil.copy("%s" % (image_file), "%s/" % (image_file_dir))
else:
print("File does not exist.")
print(image_file)
continue
pass
if __name__ == "__main__":
main(color_classes, sv_data_image_directory, color_list_mat_file, sv_color_data)
将标注数据解析,依照颜色放置到相应文件夹中。
注意: 颜色标注个别存在问题,需求人工进行数据过滤 data cleansing or data cleaning。
/usr/bin/python3.5 /home/strong/CompCars/data_preprocessing/mat_file_color_list.py
1.0
b'MATLAB 5.0 MAT-file, Platform: PCWIN64, Created on: Thu Sep 24 14:56:52 2015'
[]
44481
Process finished with exit code 0