This is toolbox I use to work with my 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 textTool used
- Tool used to draw the piece, currenty this is can bemarker
orspray_paint
Number of colors used
-0
if more than one color is used,1
otherviseGPS coordinates
- GPS coordinates extracted from EXIF dataGraffiti Type
-tag
orgraffiti
All samples have following masks
Graffiti Mask
- Mask defining main graffiti in the imageBackground mask
- Mask defining background. This shouldn't contain any graffiti pixelsBackground graffiti
- Samples sometimes contain graffiti other than the main one. This mask define thoseIncomplete Graffiti
- This can define parts with missing or damaged areas of graffiti.
This toolbox implements few augmentations which can be applied to dataset samples
Source Image | Transformed image |
Source Image | Modified image |
Source Image | Transformed image |
Source Image | Graffiti on random background |
Source Image | Transformed image |
Source Image | Transformed image |
Samples have multiple features attached to it
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 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')
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')
python3 labelbox_to_pickle.py export.csv dataset/graffiti dataset.csv
export.csv
- CSV file exported from LabelBoxdataset/graffiti
- Directory where processed samples should be storeddataset.csv
- CSV file made when files were preprocessed before uploading to LabelBox. We need to do this in order to save GPS coordinates
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