Skip to content

pavelkraleu/graffiti-dataset

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Graffiti Dataset Toolbox

This is toolbox I use to work with my graffiti dataset.

Graffiti dataset

In this repository are few samples of this dataset to better explain its functionality.

Source Image Graffiti Mask Background mask Background graffiti Incomplete Graffiti Tool used Number of colors
Spray paint Many
Spray paint One
Spray paint One
Spray paint One
Spray paint One

All samples have following attributes

  • Readable text - If graffiti contains some readable text
  • Tool used - Tool used to draw the piece, currenty this is can be marker or spray_paint
  • Number of colors used - 0 if more than one color is used, 1 othervise
  • GPS coordinates - GPS coordinates extracted from EXIF data
  • Graffiti Type - tag or graffiti

All samples have following masks

  • Graffiti Mask - Mask defining main graffiti in the image
  • Background mask - Mask defining background. This shouldn't contain any graffiti pixels
  • Background graffiti - Samples sometimes contain graffiti other than the main one. This mask define those
  • Incomplete Graffiti - This can define parts with missing or damaged areas of graffiti.

Data augmentation

This toolbox implements few augmentations which can be applied to dataset samples

Elastic transformation

Source Image Transformed image

Modified colors

Source Image Modified image

Modified colors + Elastic transformation

Source Image Transformed image

Random background

Source Image Graffiti on random background

Random background + Random color

Source Image Transformed image

All transformations

Source Image Transformed image

Features

Samples have multiple features attached to it

Graffiti colors

The most common colors in the graffiti

Source Image RGB DBSCAN clusters
from graffiti_dataset.dataset import DatasetSample
from graffiti_dataset.tools import draw_main_colors

sample = DatasetSample('./dataset/graffiti_sample/8703f3c389a1f73f.p')

sample_main_colors = sample.main_colors()

draw_main_colors(sample_main_colors, 'colors.png')

GPS coordinates

GPS coordinates obtained from EXIF

Locations of samples in this repository :

How to generate such map

dataset_samples = glob.glob('./dataset/graffiti_sample/*.p')

gps_coordinates = []

for sample_path in dataset_samples:
    sample = DatasetSample(sample_path)
    gps_coordinates.append([sample.gps_latitude, sample.gps_longitude, sample.sample_id])

draw_map(np.array(gps_coordinates), f'./readme_images/map.html')

Color analysis

3D cube representing colors in sample can be made with tools.draw_color_cube(sample, 'pixels.html')

Colors represented as HSV can be desplayed with tools.draw_hsv_pixels(sample, 'out.png')

Process data from LabelBox

python3 labelbox_to_pickle.py export.csv dataset/graffiti dataset.csv
  • export.csv - CSV file exported from LabelBox
  • dataset/graffiti - Directory where processed samples should be stored
  • dataset.csv - CSV file made when files were preprocessed before uploading to LabelBox. We need to do this in order to save GPS coordinates

Prepare data to upload to LabelBox

python3 data_to_labelbox.py './inout_data/*.JPG' ./output_direcotry/ ./new_data.csv
  • ./inout_data/*.JPG - Where to look for new data
  • ./output_direcotry/ - Where to put processed images
  • ./new_data.csv - Where to store CSV describing new data

About

Toolbox for graffiti dataset 🎨

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published