clustering

Fill in a module description here
import math

import pandas as pd
from fastai.vision.all import *

from singleline_dataset.embeddings import *
from singleline_dataset.fileorg import *
no env var SINGLELINE_DATA_HOME, defaulting to: None
EXTERNAL_PARENT_DIR = Path('/Users/al/Dropbox/2-Areas/2-Sketchbooks')
EXTERNAL_SKETCHBOOKS_DIR = EXTERNAL_PARENT_DIR / 'sketchbooks'
EXTERNAL_DATA_HOME = EXTERNAL_PARENT_DIR / 'singleline_data'
EPOCH = SketchbookEpoch(epoch='20231214', data_home=EXTERNAL_DATA_HOME)

CURR_01_FLAT = EPOCH.dir_01_FLAT()
CURR_02_CATEGORIZED = EPOCH.dir_02_CATEGORIZED()
CURR_03_HAND = EPOCH.dir_03_HANDLABELED()
no env var SINGLELINE_DATA_HOME, defaulting to: None
EXTERNAL_SKETCHBOOKS_DIR.ls()[:2]
(#2) [Path('/Users/al/Dropbox/2-Areas/2-Sketchbooks/sketchbooks/sb67'),Path('/Users/al/Dropbox/2-Areas/2-Sketchbooks/sketchbooks/sb69')]
# flatten_sketchbooks(EXTERNAL_SKETCHBOOKS_DIR, CURR_01_FLAT)
CURR_01_FLAT
Path('/Users/al/Dropbox/2-Areas/2-Sketchbooks/singleline_data/raster/epoch-20231214/01_FLAT')

separate DF’s for drawings, watercolors

drawings_df = cdf[cdf.handlabeled_metacluster_name == "0_drawings"]
drawings_df.head()
abs_fname rel_fname label pred_label pred_idx pred_probs emb_csv cluster cluster_dist metacluster ... indiv_fname visual_rel_path visual_abs_path handlabeled_rel_path handlabeled_metacluster_name handlabeled_metacluster_id handlabeled_metacluster_was_correct preprocessed_abs_path handlabeled_abs_path emb_csv_cropped
idx
0 /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/01_FLAT/art/sb77p043.jpg art/sb77p043.jpg art xtra 4 0.168532,0.008473,0.008068,0.016940,0.797986 -0.6198182,-0.5714155,-0.6871516,-0.6553513,-0.6254566,-0.65341413,-0.7267234,-0.4896673,-0.7537334,-0.42715576,1.4904574,-0.72562873,-0.662768,-0.6266761,0.6913696,0.054546177,-0.5467274,-0.6520286,0.117179275,0.94330966,0.5815062,-0.55193967,-0.5446661,-0.6779002,-0.57759243,-0.4584825,-0.3818994,-0.5750927,-0.73986673,-0.45211998,-0.6141643,-0.67007643,-0.52171326,-0.4592305,1.4788612,-0.6186755,0.799198,-0.57338566,-0.17778617,0.10336053,0.093812525,0.17924881,-0.6189488,-0.6682474,2.1040225,-0.59257406,1.6553459,-0.6001429,0.5109105,0.19352531,-0.2517513,-0.66552746,-0.6482407,-0.4732... 11 199.22961 1 ... sb77p043.jpg 1_watercolors/sb77p043.jpg /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/02_VISUAL_CATEGORIES/1_watercolors/sb77p043.jpg 0_drawings/sb77p043.jpg 0_drawings 0 False /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/10_SIMPLE_CROP/0_drawings/sb77p043.jpg /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/03_VISUAL_HAND_LABELED/0_drawings/sb77p043.jpg -0.6198182,-0.5714155,0.2937309,0.2691822,-0.6254566,-0.46855158,-0.7267234,-0.4896673,-0.7537334,-0.42715576,2.241211,-0.013144195,-0.30681813,-0.6266761,0.43516117,-0.57515705,-0.5467274,-0.5245168,1.3334948,2.1400952,-0.64108604,-0.55193967,-0.5446661,-0.6779002,-0.57759243,-0.6690378,0.38178188,-0.5982413,-0.50063276,-0.21540937,0.4948988,-0.67007643,-0.52171326,-0.4592305,1.8570362,-0.6186755,0.94023055,-0.57338566,0.5270257,-0.6179389,2.302543,1.1004333,0.15528035,-0.6682474,1.890626,-0.59257406,1.331521,-0.6001429,1.5220151,0.93749076,-0.59497476,-0.66552746,-0.6482407,-0.4732165,0....
1 /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/01_FLAT/art/sb67p021.jpg art/sb67p021.jpg art xtra 4 0.170976,0.008673,0.008480,0.017028,0.794843 1.1073987,0.3512016,-0.73929733,-0.6553513,1.7477593,-0.65341413,0.32179314,-0.4896673,-0.1797334,-0.42715576,1.3163843,-0.72562873,-0.61387855,-0.6266761,-0.35361218,0.37611246,-0.08771938,-0.5262803,0.9261699,-0.6497359,-0.64108604,-0.55193967,-0.5446661,-0.6779002,-0.32559583,-0.6690378,-0.4518578,0.51828945,-0.4238917,-0.45211998,-0.16527033,-0.67007643,1.0136865,-0.4592305,-0.600525,-0.060860336,-0.19446748,-0.24127388,2.2282472,1.8003348,-0.61049384,0.39795423,0.2626753,-0.6682474,-0.75794554,-0.59257406,0.80257696,-0.6001429,-0.651804,-0.028328001,0.53641737,-0.6501347,-0.6482407,0.... 3 132.26111 0 ... sb67p021.jpg 0_drawings/sb67p021.jpg /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/02_VISUAL_CATEGORIES/0_drawings/sb67p021.jpg 0_drawings/sb67p021.jpg 0_drawings 0 True /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/10_SIMPLE_CROP/0_drawings/sb67p021.jpg /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/03_VISUAL_HAND_LABELED/0_drawings/sb67p021.jpg -0.20756221,-0.24843562,0.29454154,-0.6553513,-0.6254566,-0.65341413,-0.7267234,-0.4896673,-0.7537334,-0.42715576,0.9697293,-0.72562873,-0.662768,-0.6266761,-0.23836556,0.4814458,-0.5467274,-0.6520286,0.838902,-0.6497359,-0.57338166,-0.55193967,-0.5446661,-0.28419846,1.6012006,-0.6690378,-0.4518578,-0.0104218125,-0.73986673,-0.3002332,-0.68509877,-0.67007643,-0.36297536,-0.4592305,-0.600525,-0.6186755,-0.73933,-0.57338566,-0.65925777,1.6904012,-0.61049384,-0.58021957,0.508085,0.14767355,0.8082305,-0.59257406,-0.6157326,-0.6001429,-0.651804,-0.30467254,0.17396247,-0.66552746,-0.6482407,-0.0...
3 /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/01_FLAT/art/sb25p227.jpg art/sb25p227.jpg art xtra 4 0.158396,0.008277,0.007424,0.016584,0.809319 1.3776337,-0.5714155,-0.2587232,-0.6553513,1.3532461,-0.65341413,-0.7267234,-0.4896673,-0.7537334,-0.25077122,0.050992966,-0.72562873,0.1406585,-0.6266761,1.0653365,0.96198404,-0.5467274,0.30261123,0.6327609,-0.6497359,-0.64108604,-0.28434965,-0.35651857,-0.6779002,-0.28245115,-0.6690378,-0.4518578,0.030088186,-0.73986673,-0.18931103,-0.041653574,-0.67007643,-0.52171326,-0.29881266,-0.600525,-0.23231092,-0.73933,-0.57338566,-0.65925777,1.8833572,-0.61049384,0.44560486,0.14075392,-0.6682474,-0.75794554,-0.59257406,-0.07511848,-0.6001429,-0.651804,-0.5315948,0.023931146,0.723624,-0.6482407,-... 8 188.58075 0 ... sb25p227.jpg 0_drawings/sb25p227.jpg /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/02_VISUAL_CATEGORIES/0_drawings/sb25p227.jpg 0_drawings/sb25p227.jpg 0_drawings 0 True /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/10_SIMPLE_CROP/0_drawings/sb25p227.jpg /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/03_VISUAL_HAND_LABELED/0_drawings/sb25p227.jpg -0.6198182,-0.428226,-0.73929733,-0.6553513,-0.49369657,-0.65341413,-0.7267234,-0.4896673,-0.7537334,-0.28293163,-0.62038505,-0.32824886,2.5504894,-0.6266761,0.8397537,0.85716057,-0.5467274,-0.058725297,0.64954805,-0.6497359,-0.64108604,-0.36876833,-0.5446661,-0.29563427,0.08626467,-0.6690378,-0.4518578,0.64337015,-0.73986673,0.018805295,-0.68509877,-0.67007643,1.5876667,-0.4592305,-0.600525,-0.6186755,0.28688914,-0.57338566,-0.65925777,1.6810645,-0.61049384,1.8564332,-0.6189488,-0.6682474,-0.75794554,-0.59257406,-0.6157326,-0.6001429,-0.63579994,-0.45296612,-0.29925343,-0.0263654,-0.64824...
6 /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/01_FLAT/art/sb48p057.jpg art/sb48p057.jpg art xtra 4 0.165322,0.008453,0.008010,0.016587,0.801628 2.4936543,0.17563903,-0.6522293,-0.55642915,1.1084181,-0.5028205,-0.046447277,-0.4896673,-0.7537334,-0.42715576,0.84124434,-0.72562873,-0.52445275,-0.5557985,-0.21369287,2.2372599,-0.26381853,-0.6520286,-0.6898426,-0.6497359,-0.64108604,0.43080842,-0.23286673,-0.6779002,0.7969176,-0.6690378,-0.4518578,0.747658,0.04896885,-0.45211998,-0.68509877,-0.2462106,0.7319356,-0.4592305,-0.600525,-0.6186755,-0.5338096,-0.57338566,1.1886733,0.04046011,-0.61049384,0.45326668,0.72983754,-0.6682474,-0.10000485,0.034278154,-0.33160114,-0.6001429,-0.651804,-0.5315948,-0.20898154,-0.66552746,1.2346795,-0.47... 14 90.26291 0 ... sb48p057.jpg 0_drawings/sb48p057.jpg /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/02_VISUAL_CATEGORIES/0_drawings/sb48p057.jpg 0_drawings/sb48p057.jpg 0_drawings 0 True /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/10_SIMPLE_CROP/0_drawings/sb48p057.jpg /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/03_VISUAL_HAND_LABELED/0_drawings/sb48p057.jpg -0.34353483,-0.5714155,2.2665114,-0.6553513,-0.42076486,-0.6254998,-0.7267234,-0.4896673,-0.7537334,-0.42715576,0.6137707,-0.72562873,0.2611376,1.0485492,0.91806084,-0.452704,-0.5467274,-0.6520286,0.621349,-0.6497359,-0.64108604,-0.55193967,-0.5446661,-0.6779002,0.7967064,0.011958599,-0.4518578,-0.25104153,-0.6493137,-0.45211998,-0.02894944,-0.67007643,1.3037661,-0.4592305,-0.600525,-0.6186755,-0.072172046,-0.57338566,0.42140257,0.8994249,-0.61049384,-0.35844505,-0.03452295,-0.40064916,0.1334514,-0.59257406,-0.06328797,-0.6001429,-0.651804,-0.5315948,0.55393887,-0.66552746,-0.6482407,0.165...
8 /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/01_FLAT/art/sb77p044.jpg art/sb77p044.jpg art xtra 4 0.171638,0.008182,0.008061,0.016469,0.795650 2.170152,-0.01916939,-0.47766963,-0.6553513,-0.44795185,-0.65341413,1.5596724,-0.4896673,-0.7537334,-0.42715576,1.0671424,-0.72562873,1.8207353,-0.6266761,-0.6194963,1.1724913,-0.5467274,0.12343103,1.5514618,-0.6497359,0.23890108,-0.55193967,-0.5446661,-0.6779002,-0.57759243,0.33040416,-0.4518578,0.39869583,0.120936334,-0.45211998,-0.68509877,0.2514736,0.17836922,-0.4592305,-0.600525,-0.6186755,-0.73933,-0.57338566,1.3668395,0.6006557,1.2428443,1.0844817,0.36636358,0.48543411,-0.5954572,-0.59257406,-0.30289415,1.2783914,0.5800507,-0.23473695,-0.59497476,-0.66552746,2.2758756,-0.4732165,-0.... 4 176.29102 0 ... sb77p044.jpg 0_drawings/sb77p044.jpg /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/02_VISUAL_CATEGORIES/0_drawings/sb77p044.jpg 0_drawings/sb77p044.jpg 0_drawings 0 True /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/10_SIMPLE_CROP/0_drawings/sb77p044.jpg /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/03_VISUAL_HAND_LABELED/0_drawings/sb77p044.jpg -0.3477007,-0.5714155,-0.73929733,-0.6553513,-0.6254566,-0.65341413,-0.7267234,-0.4896673,-0.7537334,-0.14662892,-0.43905735,-0.64813715,0.059202433,-0.6266761,-0.51404697,-0.20505324,-0.5467274,-0.6520286,1.2549256,-0.6497359,-0.64108604,-0.55193967,-0.5446661,-0.6779002,-0.41643643,-0.6690378,-0.22824319,-0.5982413,-0.73986673,-0.3338361,-0.68509877,0.10866904,-0.1451351,-0.4592305,0.5446466,0.7924262,-0.73933,-0.57338566,-0.45801556,-0.11409092,-0.4252534,0.4120332,-0.6189488,-0.28175777,2.210379,-0.59257406,-0.070759535,-0.6001429,-0.651804,0.012511611,0.26820052,-0.66552746,0.9221995,...

5 rows × 21 columns

drawings_df.head()
abs_fname rel_fname label pred_label pred_idx pred_probs emb_csv cluster cluster_dist metacluster ... indiv_fname visual_rel_path visual_abs_path handlabeled_rel_path handlabeled_metacluster_name handlabeled_metacluster_id handlabeled_metacluster_was_correct preprocessed_abs_path handlabeled_abs_path emb_csv_cropped
idx
0 /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/01_FLAT/art/sb77p043.jpg art/sb77p043.jpg art xtra 4 0.168532,0.008473,0.008068,0.016940,0.797986 -0.6198182,-0.5714155,-0.6871516,-0.6553513,-0.6254566,-0.65341413,-0.7267234,-0.4896673,-0.7537334,-0.42715576,1.4904574,-0.72562873,-0.662768,-0.6266761,0.6913696,0.054546177,-0.5467274,-0.6520286,0.117179275,0.94330966,0.5815062,-0.55193967,-0.5446661,-0.6779002,-0.57759243,-0.4584825,-0.3818994,-0.5750927,-0.73986673,-0.45211998,-0.6141643,-0.67007643,-0.52171326,-0.4592305,1.4788612,-0.6186755,0.799198,-0.57338566,-0.17778617,0.10336053,0.093812525,0.17924881,-0.6189488,-0.6682474,2.1040225,-0.59257406,1.6553459,-0.6001429,0.5109105,0.19352531,-0.2517513,-0.66552746,-0.6482407,-0.4732... 11 199.22961 1 ... sb77p043.jpg 1_watercolors/sb77p043.jpg /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/02_VISUAL_CATEGORIES/1_watercolors/sb77p043.jpg 0_drawings/sb77p043.jpg 0_drawings 0 False /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/10_SIMPLE_CROP/0_drawings/sb77p043.jpg /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/03_VISUAL_HAND_LABELED/0_drawings/sb77p043.jpg -0.6198182,-0.5714155,0.2937309,0.2691822,-0.6254566,-0.46855158,-0.7267234,-0.4896673,-0.7537334,-0.42715576,2.241211,-0.013144195,-0.30681813,-0.6266761,0.43516117,-0.57515705,-0.5467274,-0.5245168,1.3334948,2.1400952,-0.64108604,-0.55193967,-0.5446661,-0.6779002,-0.57759243,-0.6690378,0.38178188,-0.5982413,-0.50063276,-0.21540937,0.4948988,-0.67007643,-0.52171326,-0.4592305,1.8570362,-0.6186755,0.94023055,-0.57338566,0.5270257,-0.6179389,2.302543,1.1004333,0.15528035,-0.6682474,1.890626,-0.59257406,1.331521,-0.6001429,1.5220151,0.93749076,-0.59497476,-0.66552746,-0.6482407,-0.4732165,0....
1 /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/01_FLAT/art/sb67p021.jpg art/sb67p021.jpg art xtra 4 0.170976,0.008673,0.008480,0.017028,0.794843 1.1073987,0.3512016,-0.73929733,-0.6553513,1.7477593,-0.65341413,0.32179314,-0.4896673,-0.1797334,-0.42715576,1.3163843,-0.72562873,-0.61387855,-0.6266761,-0.35361218,0.37611246,-0.08771938,-0.5262803,0.9261699,-0.6497359,-0.64108604,-0.55193967,-0.5446661,-0.6779002,-0.32559583,-0.6690378,-0.4518578,0.51828945,-0.4238917,-0.45211998,-0.16527033,-0.67007643,1.0136865,-0.4592305,-0.600525,-0.060860336,-0.19446748,-0.24127388,2.2282472,1.8003348,-0.61049384,0.39795423,0.2626753,-0.6682474,-0.75794554,-0.59257406,0.80257696,-0.6001429,-0.651804,-0.028328001,0.53641737,-0.6501347,-0.6482407,0.... 3 132.26111 0 ... sb67p021.jpg 0_drawings/sb67p021.jpg /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/02_VISUAL_CATEGORIES/0_drawings/sb67p021.jpg 0_drawings/sb67p021.jpg 0_drawings 0 True /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/10_SIMPLE_CROP/0_drawings/sb67p021.jpg /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/03_VISUAL_HAND_LABELED/0_drawings/sb67p021.jpg -0.20756221,-0.24843562,0.29454154,-0.6553513,-0.6254566,-0.65341413,-0.7267234,-0.4896673,-0.7537334,-0.42715576,0.9697293,-0.72562873,-0.662768,-0.6266761,-0.23836556,0.4814458,-0.5467274,-0.6520286,0.838902,-0.6497359,-0.57338166,-0.55193967,-0.5446661,-0.28419846,1.6012006,-0.6690378,-0.4518578,-0.0104218125,-0.73986673,-0.3002332,-0.68509877,-0.67007643,-0.36297536,-0.4592305,-0.600525,-0.6186755,-0.73933,-0.57338566,-0.65925777,1.6904012,-0.61049384,-0.58021957,0.508085,0.14767355,0.8082305,-0.59257406,-0.6157326,-0.6001429,-0.651804,-0.30467254,0.17396247,-0.66552746,-0.6482407,-0.0...
3 /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/01_FLAT/art/sb25p227.jpg art/sb25p227.jpg art xtra 4 0.158396,0.008277,0.007424,0.016584,0.809319 1.3776337,-0.5714155,-0.2587232,-0.6553513,1.3532461,-0.65341413,-0.7267234,-0.4896673,-0.7537334,-0.25077122,0.050992966,-0.72562873,0.1406585,-0.6266761,1.0653365,0.96198404,-0.5467274,0.30261123,0.6327609,-0.6497359,-0.64108604,-0.28434965,-0.35651857,-0.6779002,-0.28245115,-0.6690378,-0.4518578,0.030088186,-0.73986673,-0.18931103,-0.041653574,-0.67007643,-0.52171326,-0.29881266,-0.600525,-0.23231092,-0.73933,-0.57338566,-0.65925777,1.8833572,-0.61049384,0.44560486,0.14075392,-0.6682474,-0.75794554,-0.59257406,-0.07511848,-0.6001429,-0.651804,-0.5315948,0.023931146,0.723624,-0.6482407,-... 8 188.58075 0 ... sb25p227.jpg 0_drawings/sb25p227.jpg /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/02_VISUAL_CATEGORIES/0_drawings/sb25p227.jpg 0_drawings/sb25p227.jpg 0_drawings 0 True /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/10_SIMPLE_CROP/0_drawings/sb25p227.jpg /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/03_VISUAL_HAND_LABELED/0_drawings/sb25p227.jpg -0.6198182,-0.428226,-0.73929733,-0.6553513,-0.49369657,-0.65341413,-0.7267234,-0.4896673,-0.7537334,-0.28293163,-0.62038505,-0.32824886,2.5504894,-0.6266761,0.8397537,0.85716057,-0.5467274,-0.058725297,0.64954805,-0.6497359,-0.64108604,-0.36876833,-0.5446661,-0.29563427,0.08626467,-0.6690378,-0.4518578,0.64337015,-0.73986673,0.018805295,-0.68509877,-0.67007643,1.5876667,-0.4592305,-0.600525,-0.6186755,0.28688914,-0.57338566,-0.65925777,1.6810645,-0.61049384,1.8564332,-0.6189488,-0.6682474,-0.75794554,-0.59257406,-0.6157326,-0.6001429,-0.63579994,-0.45296612,-0.29925343,-0.0263654,-0.64824...
6 /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/01_FLAT/art/sb48p057.jpg art/sb48p057.jpg art xtra 4 0.165322,0.008453,0.008010,0.016587,0.801628 2.4936543,0.17563903,-0.6522293,-0.55642915,1.1084181,-0.5028205,-0.046447277,-0.4896673,-0.7537334,-0.42715576,0.84124434,-0.72562873,-0.52445275,-0.5557985,-0.21369287,2.2372599,-0.26381853,-0.6520286,-0.6898426,-0.6497359,-0.64108604,0.43080842,-0.23286673,-0.6779002,0.7969176,-0.6690378,-0.4518578,0.747658,0.04896885,-0.45211998,-0.68509877,-0.2462106,0.7319356,-0.4592305,-0.600525,-0.6186755,-0.5338096,-0.57338566,1.1886733,0.04046011,-0.61049384,0.45326668,0.72983754,-0.6682474,-0.10000485,0.034278154,-0.33160114,-0.6001429,-0.651804,-0.5315948,-0.20898154,-0.66552746,1.2346795,-0.47... 14 90.26291 0 ... sb48p057.jpg 0_drawings/sb48p057.jpg /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/02_VISUAL_CATEGORIES/0_drawings/sb48p057.jpg 0_drawings/sb48p057.jpg 0_drawings 0 True /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/10_SIMPLE_CROP/0_drawings/sb48p057.jpg /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/03_VISUAL_HAND_LABELED/0_drawings/sb48p057.jpg -0.34353483,-0.5714155,2.2665114,-0.6553513,-0.42076486,-0.6254998,-0.7267234,-0.4896673,-0.7537334,-0.42715576,0.6137707,-0.72562873,0.2611376,1.0485492,0.91806084,-0.452704,-0.5467274,-0.6520286,0.621349,-0.6497359,-0.64108604,-0.55193967,-0.5446661,-0.6779002,0.7967064,0.011958599,-0.4518578,-0.25104153,-0.6493137,-0.45211998,-0.02894944,-0.67007643,1.3037661,-0.4592305,-0.600525,-0.6186755,-0.072172046,-0.57338566,0.42140257,0.8994249,-0.61049384,-0.35844505,-0.03452295,-0.40064916,0.1334514,-0.59257406,-0.06328797,-0.6001429,-0.651804,-0.5315948,0.55393887,-0.66552746,-0.6482407,0.165...
8 /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/01_FLAT/art/sb77p044.jpg art/sb77p044.jpg art xtra 4 0.171638,0.008182,0.008061,0.016469,0.795650 2.170152,-0.01916939,-0.47766963,-0.6553513,-0.44795185,-0.65341413,1.5596724,-0.4896673,-0.7537334,-0.42715576,1.0671424,-0.72562873,1.8207353,-0.6266761,-0.6194963,1.1724913,-0.5467274,0.12343103,1.5514618,-0.6497359,0.23890108,-0.55193967,-0.5446661,-0.6779002,-0.57759243,0.33040416,-0.4518578,0.39869583,0.120936334,-0.45211998,-0.68509877,0.2514736,0.17836922,-0.4592305,-0.600525,-0.6186755,-0.73933,-0.57338566,1.3668395,0.6006557,1.2428443,1.0844817,0.36636358,0.48543411,-0.5954572,-0.59257406,-0.30289415,1.2783914,0.5800507,-0.23473695,-0.59497476,-0.66552746,2.2758756,-0.4732165,-0.... 4 176.29102 0 ... sb77p044.jpg 0_drawings/sb77p044.jpg /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/02_VISUAL_CATEGORIES/0_drawings/sb77p044.jpg 0_drawings/sb77p044.jpg 0_drawings 0 True /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/10_SIMPLE_CROP/0_drawings/sb77p044.jpg /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/03_VISUAL_HAND_LABELED/0_drawings/sb77p044.jpg -0.3477007,-0.5714155,-0.73929733,-0.6553513,-0.6254566,-0.65341413,-0.7267234,-0.4896673,-0.7537334,-0.14662892,-0.43905735,-0.64813715,0.059202433,-0.6266761,-0.51404697,-0.20505324,-0.5467274,-0.6520286,1.2549256,-0.6497359,-0.64108604,-0.55193967,-0.5446661,-0.6779002,-0.41643643,-0.6690378,-0.22824319,-0.5982413,-0.73986673,-0.3338361,-0.68509877,0.10866904,-0.1451351,-0.4592305,0.5446466,0.7924262,-0.73933,-0.57338566,-0.45801556,-0.11409092,-0.4252534,0.4120332,-0.6189488,-0.28175777,2.210379,-0.59257406,-0.070759535,-0.6001429,-0.651804,0.012511611,0.26820052,-0.66552746,0.9221995,...

5 rows × 21 columns

# reindex so I have you
drawings_df.set_index(pd.Index(range(len(drawings_df))), inplace=True)
drawings_df.label.hist()

drawings_df.cluster.hist()

watercolors_df = cdf[cdf.handlabeled_metacluster_name == "1_watercolors"]
watercolors_df.head()
abs_fname rel_fname label pred_label pred_idx pred_probs emb_csv cluster cluster_dist metacluster ... indiv_fname visual_rel_path visual_abs_path handlabeled_rel_path handlabeled_metacluster_name handlabeled_metacluster_id handlabeled_metacluster_was_correct preprocessed_abs_path handlabeled_abs_path emb_csv_cropped
idx
4 /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/01_FLAT/art/sb07p104.jpg art/sb07p104.jpg art xtra 4 0.177406,0.008799,0.008245,0.017177,0.788373 -0.39105213,0.96309596,-0.73929733,0.4489988,0.8297614,-0.3937308,-0.7267234,-0.32461396,-0.7537334,-0.42715576,-0.62038505,-0.72562873,0.3037846,-0.6266761,-0.5213815,-0.31669965,-0.5467274,-0.6520286,-0.22544897,-0.6497359,-0.64108604,0.6374447,-0.5446661,-0.6779002,-0.14143991,-0.6690378,-0.44753593,0.66945183,-0.73986673,-0.45211998,-0.05996394,-0.21525535,0.82928157,-0.04412651,-0.600525,-0.04148197,-0.73825717,-0.57338566,-0.25227422,2.3566113,-0.61049384,1.0027854,-0.40134108,1.3733256,-0.75794554,-0.59257406,-0.4395525,-0.6001429,1.0358506,1.1911299,0.8162154,0.032713354,-0.6482407... 5 238.33170 1 ... sb07p104.jpg 1_watercolors/sb07p104.jpg /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/02_VISUAL_CATEGORIES/1_watercolors/sb07p104.jpg 1_watercolors/sb07p104.jpg 1_watercolors 1 True /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/10_SIMPLE_CROP/1_watercolors/sb07p104.jpg /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/03_VISUAL_HAND_LABELED/1_watercolors/sb07p104.jpg -0.6198182,0.8895926,-0.73929733,0.6418346,0.46164584,1.0085131,-0.7267234,-0.4896673,-0.7537334,-0.42715576,-0.62038505,-0.72562873,1.4399182,-0.6266761,0.474914,-0.57515705,-0.5467274,-0.6520286,1.2274435,-0.6497359,-0.27622125,-0.45870692,-0.5446661,-0.6779002,1.3343718,-0.6690378,-0.4518578,0.42277813,-0.73986673,-0.45211998,1.6291834,-0.67007643,-0.09817025,-0.00090405345,-0.600525,-0.6186755,-0.73933,-0.57338566,0.006386578,1.034553,-0.61049384,-0.58021957,-0.09483403,0.78779536,-0.73080033,0.10947651,0.3367887,-0.5382227,-0.26548737,0.5630663,2.15088,0.2266624,-0.6482407,0.049348265...
5 /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/01_FLAT/art/sb31p017.jpg art/sb31p017.jpg art xtra 4 0.172119,0.008924,0.008226,0.016950,0.793781 -0.05104202,-0.3935787,-0.73929733,0.86878717,-0.6254566,-0.65341413,-0.7267234,-0.4896673,-0.7537334,-0.14799604,-0.62038505,-0.72562873,-0.2654881,-0.6266761,-0.68991846,-0.57515705,-0.41532665,-0.6520286,-0.6898426,-0.34099144,-0.64108604,-0.55193967,-0.5446661,-0.6779002,-0.2674706,-0.53598946,-0.13334358,-0.5982413,-0.73986673,-0.45211998,-0.68509877,0.033780396,-0.52171326,0.054827005,-0.20721096,0.3301326,-0.73933,-0.57338566,0.34032136,-0.6179389,-0.20170414,0.16225064,-0.44437563,0.44581896,-0.069196045,0.20976627,-0.07846111,-0.6001429,0.38122594,-0.09738222,-0.59497476,-0.665527... 11 191.66959 1 ... sb31p017.jpg 1_watercolors/sb31p017.jpg /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/02_VISUAL_CATEGORIES/1_watercolors/sb31p017.jpg 1_watercolors/sb31p017.jpg 1_watercolors 1 True /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/10_SIMPLE_CROP/1_watercolors/sb31p017.jpg /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/03_VISUAL_HAND_LABELED/1_watercolors/sb31p017.jpg 1.491735,-0.5714155,-0.73929733,0.05867392,0.5154146,0.0936929,-0.7267234,-0.4896673,0.4246894,-0.42715576,-0.33477074,-0.72562873,1.2274611,-0.6266761,-0.68991846,-0.57515705,-0.5467274,1.1312869,-0.06054777,-0.028933167,-0.64108604,-0.55193967,-0.5446661,-0.6779002,-0.57759243,0.46393585,0.4817328,0.22738433,-0.73986673,-0.45211998,0.0057709217,-0.67007643,-0.52171326,0.68283725,0.060967267,0.7253895,-0.73933,-0.57338566,-0.65925777,-0.6179389,-0.32987997,0.86336035,-0.6189488,1.3613329,1.2250904,-0.59257406,-0.5857397,-0.6001429,-0.5687719,-0.14814761,0.5325973,-0.66552746,-0.6482407,0....
21 /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/01_FLAT/art/sb05p079.jpg art/sb05p079.jpg art xtra 4 0.172158,0.008873,0.008536,0.017017,0.793416 1.8089037,-0.5714155,-0.73929733,-0.10773122,-0.22753507,0.34884918,0.124596715,-0.4896673,-0.27447522,-0.42715576,0.61659455,-0.03226477,-0.662768,-0.6266761,-0.68991846,-0.57515705,-0.39897114,-0.6520286,-0.6898426,-0.6497359,0.16184372,-0.55193967,-0.5446661,-0.6779002,0.04647112,-0.6690378,-0.4518578,0.9576235,0.29423904,-0.45211998,-0.68509877,0.09260088,-0.3948297,-0.4592305,-0.600525,-0.6186755,-0.64046603,-0.57338566,0.08902073,0.09568572,-0.61049384,0.7515181,-0.15892029,-0.4098586,1.8483992,-0.59257406,-0.6157326,-0.56642026,-0.651804,-0.44185895,-0.19970179,0.19587982,1.3608505,... 11 140.32997 1 ... sb05p079.jpg 1_watercolors/sb05p079.jpg /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/02_VISUAL_CATEGORIES/1_watercolors/sb05p079.jpg 1_watercolors/sb05p079.jpg 1_watercolors 1 NaN /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/10_SIMPLE_CROP/1_watercolors/sb05p079.jpg /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/03_VISUAL_HAND_LABELED/1_watercolors/sb05p079.jpg -0.6013173,-0.5714155,-0.7368871,-0.6553513,-0.6254566,-0.65341413,0.071327925,-0.4896673,-0.7537334,-0.29406685,1.2854458,-0.72562873,1.4279991,-0.2084853,0.4439276,-0.57515705,-0.5467274,-0.2426523,0.6567551,-0.6497359,0.284827,-0.55193967,-0.5446661,-0.6779002,-0.57759243,-0.6690378,0.39760548,-0.5982413,-0.16403872,0.82081807,-0.68509877,-0.67007643,-0.16007048,-0.23898152,0.4340614,-0.6186755,-0.73933,-0.57338566,-0.65925777,-0.60700464,-0.22504222,1.2887287,0.17025876,-0.5827259,3.245521,-0.59257406,1.607188,-0.6001429,-0.1800242,-0.5315948,0.2059763,0.33526373,0.109642506,-0.0013180...
24 /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/01_FLAT/art/sb26p082.jpg art/sb26p082.jpg art xtra 4 0.179525,0.008828,0.008282,0.017196,0.786169 1.8392665,0.3796271,-0.73929733,0.82189727,1.6830277,0.9302285,-0.5532687,-0.4896673,-0.30764756,-0.42715576,-0.44450876,-0.72562873,-0.662768,0.54702616,-0.68991846,-0.57515705,-0.31611928,-0.59368926,1.2819774,-0.6497359,-0.64108604,-0.55193967,0.84984857,-0.6779002,-0.06536412,-0.6690378,0.34403068,-0.16627067,0.3990196,-0.45211998,0.65170527,-0.67007643,0.6049255,-0.4367706,-0.600525,-0.0046679974,-0.73933,-0.109048486,-0.65925777,0.65358853,-0.61049384,0.70374626,-0.6189488,-0.6682474,-0.0177418,-0.59257406,1.1068444,-0.29651338,-0.651804,-0.5315948,1.8200746,-0.66552746,0.11623299,-0... 7 176.11029 1 ... sb26p082.jpg 1_watercolors/sb26p082.jpg /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/02_VISUAL_CATEGORIES/1_watercolors/sb26p082.jpg 1_watercolors/sb26p082.jpg 1_watercolors 1 NaN /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/10_SIMPLE_CROP/1_watercolors/sb26p082.jpg /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/03_VISUAL_HAND_LABELED/1_watercolors/sb26p082.jpg 0.8175719,0.48385304,-0.73929733,1.0291914,1.4682066,1.225123,-0.43518582,-0.4896673,-0.7537334,-0.42715576,0.72162604,-0.72562873,-0.662768,-0.6266761,-0.55470747,-0.57515705,-0.5467274,-0.6520286,2.099903,-0.6497359,-0.64108604,-0.55193967,1.3572993,-0.6779002,1.3149762,0.8512635,0.81857395,-0.5982413,0.056738913,-0.45211998,2.0946088,-0.67007643,-0.52171326,-0.4592305,-0.600525,1.1100725,-0.73933,-0.57338566,-0.24140868,0.9004108,-0.61049384,0.4742828,-0.6189488,-0.6682474,0.335356,0.40166396,0.7790335,-0.6001429,-0.651804,-0.4778452,0.7360641,-0.66552746,-0.6482407,-0.13845,-0.7311095,...
28 /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/01_FLAT/art/sb69p101-color.jpg art/sb69p101-color.jpg art xtra 4 0.179525,0.008828,0.008282,0.017196,0.786169 -0.23259398,-0.5714155,-0.73929733,-0.6553513,0.34417403,1.046661,-0.42288247,-0.4896673,0.39017296,-0.42715576,-0.62038505,-0.72562873,-0.662768,-0.6266761,0.93892807,-0.57515705,-0.5222921,-0.6520286,-0.6898426,-0.6497359,-0.6366938,-0.55193967,-0.5446661,-0.6779002,-0.46687827,-0.6690378,-0.4518578,-0.5982413,0.7252437,-0.45211998,1.8137504,-0.67007643,-0.52171326,-0.36457688,-0.600525,0.8178272,-0.73933,0.23574609,-0.65925777,-0.6179389,-0.61049384,-0.15158218,-0.41958112,-0.6682474,-0.75794554,0.4943592,0.8210626,-0.6001429,-0.651804,-0.080083996,0.48374963,-0.42743486,-0.6482407,-0.4... 7 187.45346 1 ... sb69p101-color.jpg 1_watercolors/sb69p101-color.jpg /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/02_VISUAL_CATEGORIES/1_watercolors/sb69p101-color.jpg 1_watercolors/sb69p101-color.jpg 1_watercolors 1 NaN /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/10_SIMPLE_CROP/1_watercolors/sb69p101-color.jpg /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/03_VISUAL_HAND_LABELED/1_watercolors/sb69p101-color.jpg 0.14908737,-0.5714155,-0.73929733,0.44245207,-0.6254566,1.4611686,-0.7267234,-0.4896673,0.87923527,-0.42715576,-0.62038505,-0.72562873,-0.662768,-0.6266761,0.4918049,-0.57515705,-0.5467274,-0.6520286,-0.6898426,-0.2860955,-0.64108604,-0.55193967,-0.5446661,-0.6779002,0.69009775,-0.6690378,-0.4518578,0.18292433,-0.004632473,-0.45211998,1.7543458,-0.67007643,-0.52171326,-0.41669255,-0.600525,1.4654884,0.5742926,-0.57338566,-0.65925777,-0.6179389,-0.52983093,0.26484245,-0.25630984,-0.6682474,0.19898295,0.95297796,0.38033813,-0.6001429,-0.651804,-0.5315948,1.3264011,0.31547034,-0.6482407,-0.47...

5 rows × 21 columns

watercolors_df.set_index(pd.Index(range(len(watercolors_df))), inplace=True)
watercolors_df.head()
abs_fname rel_fname label pred_label pred_idx pred_probs emb_csv cluster cluster_dist metacluster ... indiv_fname visual_rel_path visual_abs_path handlabeled_rel_path handlabeled_metacluster_name handlabeled_metacluster_id handlabeled_metacluster_was_correct preprocessed_abs_path handlabeled_abs_path emb_csv_cropped
0 /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/01_FLAT/art/sb07p104.jpg art/sb07p104.jpg art xtra 4 0.177406,0.008799,0.008245,0.017177,0.788373 -0.39105213,0.96309596,-0.73929733,0.4489988,0.8297614,-0.3937308,-0.7267234,-0.32461396,-0.7537334,-0.42715576,-0.62038505,-0.72562873,0.3037846,-0.6266761,-0.5213815,-0.31669965,-0.5467274,-0.6520286,-0.22544897,-0.6497359,-0.64108604,0.6374447,-0.5446661,-0.6779002,-0.14143991,-0.6690378,-0.44753593,0.66945183,-0.73986673,-0.45211998,-0.05996394,-0.21525535,0.82928157,-0.04412651,-0.600525,-0.04148197,-0.73825717,-0.57338566,-0.25227422,2.3566113,-0.61049384,1.0027854,-0.40134108,1.3733256,-0.75794554,-0.59257406,-0.4395525,-0.6001429,1.0358506,1.1911299,0.8162154,0.032713354,-0.6482407... 5 238.33170 1 ... sb07p104.jpg 1_watercolors/sb07p104.jpg /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/02_VISUAL_CATEGORIES/1_watercolors/sb07p104.jpg 1_watercolors/sb07p104.jpg 1_watercolors 1 True /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/10_SIMPLE_CROP/1_watercolors/sb07p104.jpg /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/03_VISUAL_HAND_LABELED/1_watercolors/sb07p104.jpg -0.6198182,0.8895926,-0.73929733,0.6418346,0.46164584,1.0085131,-0.7267234,-0.4896673,-0.7537334,-0.42715576,-0.62038505,-0.72562873,1.4399182,-0.6266761,0.474914,-0.57515705,-0.5467274,-0.6520286,1.2274435,-0.6497359,-0.27622125,-0.45870692,-0.5446661,-0.6779002,1.3343718,-0.6690378,-0.4518578,0.42277813,-0.73986673,-0.45211998,1.6291834,-0.67007643,-0.09817025,-0.00090405345,-0.600525,-0.6186755,-0.73933,-0.57338566,0.006386578,1.034553,-0.61049384,-0.58021957,-0.09483403,0.78779536,-0.73080033,0.10947651,0.3367887,-0.5382227,-0.26548737,0.5630663,2.15088,0.2266624,-0.6482407,0.049348265...
1 /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/01_FLAT/art/sb31p017.jpg art/sb31p017.jpg art xtra 4 0.172119,0.008924,0.008226,0.016950,0.793781 -0.05104202,-0.3935787,-0.73929733,0.86878717,-0.6254566,-0.65341413,-0.7267234,-0.4896673,-0.7537334,-0.14799604,-0.62038505,-0.72562873,-0.2654881,-0.6266761,-0.68991846,-0.57515705,-0.41532665,-0.6520286,-0.6898426,-0.34099144,-0.64108604,-0.55193967,-0.5446661,-0.6779002,-0.2674706,-0.53598946,-0.13334358,-0.5982413,-0.73986673,-0.45211998,-0.68509877,0.033780396,-0.52171326,0.054827005,-0.20721096,0.3301326,-0.73933,-0.57338566,0.34032136,-0.6179389,-0.20170414,0.16225064,-0.44437563,0.44581896,-0.069196045,0.20976627,-0.07846111,-0.6001429,0.38122594,-0.09738222,-0.59497476,-0.665527... 11 191.66959 1 ... sb31p017.jpg 1_watercolors/sb31p017.jpg /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/02_VISUAL_CATEGORIES/1_watercolors/sb31p017.jpg 1_watercolors/sb31p017.jpg 1_watercolors 1 True /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/10_SIMPLE_CROP/1_watercolors/sb31p017.jpg /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/03_VISUAL_HAND_LABELED/1_watercolors/sb31p017.jpg 1.491735,-0.5714155,-0.73929733,0.05867392,0.5154146,0.0936929,-0.7267234,-0.4896673,0.4246894,-0.42715576,-0.33477074,-0.72562873,1.2274611,-0.6266761,-0.68991846,-0.57515705,-0.5467274,1.1312869,-0.06054777,-0.028933167,-0.64108604,-0.55193967,-0.5446661,-0.6779002,-0.57759243,0.46393585,0.4817328,0.22738433,-0.73986673,-0.45211998,0.0057709217,-0.67007643,-0.52171326,0.68283725,0.060967267,0.7253895,-0.73933,-0.57338566,-0.65925777,-0.6179389,-0.32987997,0.86336035,-0.6189488,1.3613329,1.2250904,-0.59257406,-0.5857397,-0.6001429,-0.5687719,-0.14814761,0.5325973,-0.66552746,-0.6482407,0....
2 /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/01_FLAT/art/sb05p079.jpg art/sb05p079.jpg art xtra 4 0.172158,0.008873,0.008536,0.017017,0.793416 1.8089037,-0.5714155,-0.73929733,-0.10773122,-0.22753507,0.34884918,0.124596715,-0.4896673,-0.27447522,-0.42715576,0.61659455,-0.03226477,-0.662768,-0.6266761,-0.68991846,-0.57515705,-0.39897114,-0.6520286,-0.6898426,-0.6497359,0.16184372,-0.55193967,-0.5446661,-0.6779002,0.04647112,-0.6690378,-0.4518578,0.9576235,0.29423904,-0.45211998,-0.68509877,0.09260088,-0.3948297,-0.4592305,-0.600525,-0.6186755,-0.64046603,-0.57338566,0.08902073,0.09568572,-0.61049384,0.7515181,-0.15892029,-0.4098586,1.8483992,-0.59257406,-0.6157326,-0.56642026,-0.651804,-0.44185895,-0.19970179,0.19587982,1.3608505,... 11 140.32997 1 ... sb05p079.jpg 1_watercolors/sb05p079.jpg /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/02_VISUAL_CATEGORIES/1_watercolors/sb05p079.jpg 1_watercolors/sb05p079.jpg 1_watercolors 1 NaN /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/10_SIMPLE_CROP/1_watercolors/sb05p079.jpg /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/03_VISUAL_HAND_LABELED/1_watercolors/sb05p079.jpg -0.6013173,-0.5714155,-0.7368871,-0.6553513,-0.6254566,-0.65341413,0.071327925,-0.4896673,-0.7537334,-0.29406685,1.2854458,-0.72562873,1.4279991,-0.2084853,0.4439276,-0.57515705,-0.5467274,-0.2426523,0.6567551,-0.6497359,0.284827,-0.55193967,-0.5446661,-0.6779002,-0.57759243,-0.6690378,0.39760548,-0.5982413,-0.16403872,0.82081807,-0.68509877,-0.67007643,-0.16007048,-0.23898152,0.4340614,-0.6186755,-0.73933,-0.57338566,-0.65925777,-0.60700464,-0.22504222,1.2887287,0.17025876,-0.5827259,3.245521,-0.59257406,1.607188,-0.6001429,-0.1800242,-0.5315948,0.2059763,0.33526373,0.109642506,-0.0013180...
3 /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/01_FLAT/art/sb26p082.jpg art/sb26p082.jpg art xtra 4 0.179525,0.008828,0.008282,0.017196,0.786169 1.8392665,0.3796271,-0.73929733,0.82189727,1.6830277,0.9302285,-0.5532687,-0.4896673,-0.30764756,-0.42715576,-0.44450876,-0.72562873,-0.662768,0.54702616,-0.68991846,-0.57515705,-0.31611928,-0.59368926,1.2819774,-0.6497359,-0.64108604,-0.55193967,0.84984857,-0.6779002,-0.06536412,-0.6690378,0.34403068,-0.16627067,0.3990196,-0.45211998,0.65170527,-0.67007643,0.6049255,-0.4367706,-0.600525,-0.0046679974,-0.73933,-0.109048486,-0.65925777,0.65358853,-0.61049384,0.70374626,-0.6189488,-0.6682474,-0.0177418,-0.59257406,1.1068444,-0.29651338,-0.651804,-0.5315948,1.8200746,-0.66552746,0.11623299,-0... 7 176.11029 1 ... sb26p082.jpg 1_watercolors/sb26p082.jpg /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/02_VISUAL_CATEGORIES/1_watercolors/sb26p082.jpg 1_watercolors/sb26p082.jpg 1_watercolors 1 NaN /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/10_SIMPLE_CROP/1_watercolors/sb26p082.jpg /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/03_VISUAL_HAND_LABELED/1_watercolors/sb26p082.jpg 0.8175719,0.48385304,-0.73929733,1.0291914,1.4682066,1.225123,-0.43518582,-0.4896673,-0.7537334,-0.42715576,0.72162604,-0.72562873,-0.662768,-0.6266761,-0.55470747,-0.57515705,-0.5467274,-0.6520286,2.099903,-0.6497359,-0.64108604,-0.55193967,1.3572993,-0.6779002,1.3149762,0.8512635,0.81857395,-0.5982413,0.056738913,-0.45211998,2.0946088,-0.67007643,-0.52171326,-0.4592305,-0.600525,1.1100725,-0.73933,-0.57338566,-0.24140868,0.9004108,-0.61049384,0.4742828,-0.6189488,-0.6682474,0.335356,0.40166396,0.7790335,-0.6001429,-0.651804,-0.4778452,0.7360641,-0.66552746,-0.6482407,-0.13845,-0.7311095,...
4 /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/01_FLAT/art/sb69p101-color.jpg art/sb69p101-color.jpg art xtra 4 0.179525,0.008828,0.008282,0.017196,0.786169 -0.23259398,-0.5714155,-0.73929733,-0.6553513,0.34417403,1.046661,-0.42288247,-0.4896673,0.39017296,-0.42715576,-0.62038505,-0.72562873,-0.662768,-0.6266761,0.93892807,-0.57515705,-0.5222921,-0.6520286,-0.6898426,-0.6497359,-0.6366938,-0.55193967,-0.5446661,-0.6779002,-0.46687827,-0.6690378,-0.4518578,-0.5982413,0.7252437,-0.45211998,1.8137504,-0.67007643,-0.52171326,-0.36457688,-0.600525,0.8178272,-0.73933,0.23574609,-0.65925777,-0.6179389,-0.61049384,-0.15158218,-0.41958112,-0.6682474,-0.75794554,0.4943592,0.8210626,-0.6001429,-0.651804,-0.080083996,0.48374963,-0.42743486,-0.6482407,-0.4... 7 187.45346 1 ... sb69p101-color.jpg 1_watercolors/sb69p101-color.jpg /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/02_VISUAL_CATEGORIES/1_watercolors/sb69p101-color.jpg 1_watercolors/sb69p101-color.jpg 1_watercolors 1 NaN /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/10_SIMPLE_CROP/1_watercolors/sb69p101-color.jpg /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/03_VISUAL_HAND_LABELED/1_watercolors/sb69p101-color.jpg 0.14908737,-0.5714155,-0.73929733,0.44245207,-0.6254566,1.4611686,-0.7267234,-0.4896673,0.87923527,-0.42715576,-0.62038505,-0.72562873,-0.662768,-0.6266761,0.4918049,-0.57515705,-0.5467274,-0.6520286,-0.6898426,-0.2860955,-0.64108604,-0.55193967,-0.5446661,-0.6779002,0.69009775,-0.6690378,-0.4518578,0.18292433,-0.004632473,-0.45211998,1.7543458,-0.67007643,-0.52171326,-0.41669255,-0.600525,1.4654884,0.5742926,-0.57338566,-0.65925777,-0.6179389,-0.52983093,0.26484245,-0.25630984,-0.6682474,0.19898295,0.95297796,0.38033813,-0.6001429,-0.651804,-0.5315948,1.3264011,0.31547034,-0.6482407,-0.47...

5 rows × 21 columns

watercolors_df.label.hist()

watercolors_df.cluster.hist()

drawings_tsv_fname = f"{preprocessing_dir}/drawings.tsv"
drawings_df.to_csv(
    drawings_tsv_fname, index=True, index_label="idx", sep="\t", header=True
)
drawing_df = pd.read_csv(drawings_tsv_fname, delimiter="\t", index_col="idx")
drawing_df.head()
abs_fname rel_fname label pred_label pred_idx pred_probs emb_csv cluster cluster_dist metacluster ... indiv_fname visual_rel_path visual_abs_path handlabeled_rel_path handlabeled_metacluster_name handlabeled_metacluster_id handlabeled_metacluster_was_correct preprocessed_abs_path handlabeled_abs_path emb_csv_cropped
idx
0 /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/01_FLAT/art/sb77p043.jpg art/sb77p043.jpg art xtra 4 0.168532,0.008473,0.008068,0.016940,0.797986 -0.6198182,-0.5714155,-0.6871516,-0.6553513,-0.6254566,-0.65341413,-0.7267234,-0.4896673,-0.7537334,-0.42715576,1.4904574,-0.72562873,-0.662768,-0.6266761,0.6913696,0.054546177,-0.5467274,-0.6520286,0.117179275,0.94330966,0.5815062,-0.55193967,-0.5446661,-0.6779002,-0.57759243,-0.4584825,-0.3818994,-0.5750927,-0.73986673,-0.45211998,-0.6141643,-0.67007643,-0.52171326,-0.4592305,1.4788612,-0.6186755,0.799198,-0.57338566,-0.17778617,0.10336053,0.093812525,0.17924881,-0.6189488,-0.6682474,2.1040225,-0.59257406,1.6553459,-0.6001429,0.5109105,0.19352531,-0.2517513,-0.66552746,-0.6482407,-0.4732... 11 199.22961 1 ... sb77p043.jpg 1_watercolors/sb77p043.jpg /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/02_VISUAL_CATEGORIES/1_watercolors/sb77p043.jpg 0_drawings/sb77p043.jpg 0_drawings 0 False /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/10_SIMPLE_CROP/0_drawings/sb77p043.jpg /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/03_VISUAL_HAND_LABELED/0_drawings/sb77p043.jpg -0.6198182,-0.5714155,0.2937309,0.2691822,-0.6254566,-0.46855158,-0.7267234,-0.4896673,-0.7537334,-0.42715576,2.241211,-0.013144195,-0.30681813,-0.6266761,0.43516117,-0.57515705,-0.5467274,-0.5245168,1.3334948,2.1400952,-0.64108604,-0.55193967,-0.5446661,-0.6779002,-0.57759243,-0.6690378,0.38178188,-0.5982413,-0.50063276,-0.21540937,0.4948988,-0.67007643,-0.52171326,-0.4592305,1.8570362,-0.6186755,0.94023055,-0.57338566,0.5270257,-0.6179389,2.302543,1.1004333,0.15528035,-0.6682474,1.890626,-0.59257406,1.331521,-0.6001429,1.5220151,0.93749076,-0.59497476,-0.66552746,-0.6482407,-0.4732165,0....
1 /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/01_FLAT/art/sb67p021.jpg art/sb67p021.jpg art xtra 4 0.170976,0.008673,0.008480,0.017028,0.794843 1.1073987,0.3512016,-0.73929733,-0.6553513,1.7477593,-0.65341413,0.32179314,-0.4896673,-0.1797334,-0.42715576,1.3163843,-0.72562873,-0.61387855,-0.6266761,-0.35361218,0.37611246,-0.08771938,-0.5262803,0.9261699,-0.6497359,-0.64108604,-0.55193967,-0.5446661,-0.6779002,-0.32559583,-0.6690378,-0.4518578,0.51828945,-0.4238917,-0.45211998,-0.16527033,-0.67007643,1.0136865,-0.4592305,-0.600525,-0.060860336,-0.19446748,-0.24127388,2.2282472,1.8003348,-0.61049384,0.39795423,0.2626753,-0.6682474,-0.75794554,-0.59257406,0.80257696,-0.6001429,-0.651804,-0.028328001,0.53641737,-0.6501347,-0.6482407,0.... 3 132.26111 0 ... sb67p021.jpg 0_drawings/sb67p021.jpg /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/02_VISUAL_CATEGORIES/0_drawings/sb67p021.jpg 0_drawings/sb67p021.jpg 0_drawings 0 True /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/10_SIMPLE_CROP/0_drawings/sb67p021.jpg /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/03_VISUAL_HAND_LABELED/0_drawings/sb67p021.jpg -0.20756221,-0.24843562,0.29454154,-0.6553513,-0.6254566,-0.65341413,-0.7267234,-0.4896673,-0.7537334,-0.42715576,0.9697293,-0.72562873,-0.662768,-0.6266761,-0.23836556,0.4814458,-0.5467274,-0.6520286,0.838902,-0.6497359,-0.57338166,-0.55193967,-0.5446661,-0.28419846,1.6012006,-0.6690378,-0.4518578,-0.0104218125,-0.73986673,-0.3002332,-0.68509877,-0.67007643,-0.36297536,-0.4592305,-0.600525,-0.6186755,-0.73933,-0.57338566,-0.65925777,1.6904012,-0.61049384,-0.58021957,0.508085,0.14767355,0.8082305,-0.59257406,-0.6157326,-0.6001429,-0.651804,-0.30467254,0.17396247,-0.66552746,-0.6482407,-0.0...
2 /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/01_FLAT/art/sb25p227.jpg art/sb25p227.jpg art xtra 4 0.158396,0.008277,0.007424,0.016584,0.809319 1.3776337,-0.5714155,-0.2587232,-0.6553513,1.3532461,-0.65341413,-0.7267234,-0.4896673,-0.7537334,-0.25077122,0.050992966,-0.72562873,0.1406585,-0.6266761,1.0653365,0.96198404,-0.5467274,0.30261123,0.6327609,-0.6497359,-0.64108604,-0.28434965,-0.35651857,-0.6779002,-0.28245115,-0.6690378,-0.4518578,0.030088186,-0.73986673,-0.18931103,-0.041653574,-0.67007643,-0.52171326,-0.29881266,-0.600525,-0.23231092,-0.73933,-0.57338566,-0.65925777,1.8833572,-0.61049384,0.44560486,0.14075392,-0.6682474,-0.75794554,-0.59257406,-0.07511848,-0.6001429,-0.651804,-0.5315948,0.023931146,0.723624,-0.6482407,-... 8 188.58075 0 ... sb25p227.jpg 0_drawings/sb25p227.jpg /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/02_VISUAL_CATEGORIES/0_drawings/sb25p227.jpg 0_drawings/sb25p227.jpg 0_drawings 0 True /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/10_SIMPLE_CROP/0_drawings/sb25p227.jpg /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/03_VISUAL_HAND_LABELED/0_drawings/sb25p227.jpg -0.6198182,-0.428226,-0.73929733,-0.6553513,-0.49369657,-0.65341413,-0.7267234,-0.4896673,-0.7537334,-0.28293163,-0.62038505,-0.32824886,2.5504894,-0.6266761,0.8397537,0.85716057,-0.5467274,-0.058725297,0.64954805,-0.6497359,-0.64108604,-0.36876833,-0.5446661,-0.29563427,0.08626467,-0.6690378,-0.4518578,0.64337015,-0.73986673,0.018805295,-0.68509877,-0.67007643,1.5876667,-0.4592305,-0.600525,-0.6186755,0.28688914,-0.57338566,-0.65925777,1.6810645,-0.61049384,1.8564332,-0.6189488,-0.6682474,-0.75794554,-0.59257406,-0.6157326,-0.6001429,-0.63579994,-0.45296612,-0.29925343,-0.0263654,-0.64824...
3 /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/01_FLAT/art/sb48p057.jpg art/sb48p057.jpg art xtra 4 0.165322,0.008453,0.008010,0.016587,0.801628 2.4936543,0.17563903,-0.6522293,-0.55642915,1.1084181,-0.5028205,-0.046447277,-0.4896673,-0.7537334,-0.42715576,0.84124434,-0.72562873,-0.52445275,-0.5557985,-0.21369287,2.2372599,-0.26381853,-0.6520286,-0.6898426,-0.6497359,-0.64108604,0.43080842,-0.23286673,-0.6779002,0.7969176,-0.6690378,-0.4518578,0.747658,0.04896885,-0.45211998,-0.68509877,-0.2462106,0.7319356,-0.4592305,-0.600525,-0.6186755,-0.5338096,-0.57338566,1.1886733,0.04046011,-0.61049384,0.45326668,0.72983754,-0.6682474,-0.10000485,0.034278154,-0.33160114,-0.6001429,-0.651804,-0.5315948,-0.20898154,-0.66552746,1.2346795,-0.47... 14 90.26291 0 ... sb48p057.jpg 0_drawings/sb48p057.jpg /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/02_VISUAL_CATEGORIES/0_drawings/sb48p057.jpg 0_drawings/sb48p057.jpg 0_drawings 0 True /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/10_SIMPLE_CROP/0_drawings/sb48p057.jpg /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/03_VISUAL_HAND_LABELED/0_drawings/sb48p057.jpg -0.34353483,-0.5714155,2.2665114,-0.6553513,-0.42076486,-0.6254998,-0.7267234,-0.4896673,-0.7537334,-0.42715576,0.6137707,-0.72562873,0.2611376,1.0485492,0.91806084,-0.452704,-0.5467274,-0.6520286,0.621349,-0.6497359,-0.64108604,-0.55193967,-0.5446661,-0.6779002,0.7967064,0.011958599,-0.4518578,-0.25104153,-0.6493137,-0.45211998,-0.02894944,-0.67007643,1.3037661,-0.4592305,-0.600525,-0.6186755,-0.072172046,-0.57338566,0.42140257,0.8994249,-0.61049384,-0.35844505,-0.03452295,-0.40064916,0.1334514,-0.59257406,-0.06328797,-0.6001429,-0.651804,-0.5315948,0.55393887,-0.66552746,-0.6482407,0.165...
4 /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/01_FLAT/art/sb77p044.jpg art/sb77p044.jpg art xtra 4 0.171638,0.008182,0.008061,0.016469,0.795650 2.170152,-0.01916939,-0.47766963,-0.6553513,-0.44795185,-0.65341413,1.5596724,-0.4896673,-0.7537334,-0.42715576,1.0671424,-0.72562873,1.8207353,-0.6266761,-0.6194963,1.1724913,-0.5467274,0.12343103,1.5514618,-0.6497359,0.23890108,-0.55193967,-0.5446661,-0.6779002,-0.57759243,0.33040416,-0.4518578,0.39869583,0.120936334,-0.45211998,-0.68509877,0.2514736,0.17836922,-0.4592305,-0.600525,-0.6186755,-0.73933,-0.57338566,1.3668395,0.6006557,1.2428443,1.0844817,0.36636358,0.48543411,-0.5954572,-0.59257406,-0.30289415,1.2783914,0.5800507,-0.23473695,-0.59497476,-0.66552746,2.2758756,-0.4732165,-0.... 4 176.29102 0 ... sb77p044.jpg 0_drawings/sb77p044.jpg /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/02_VISUAL_CATEGORIES/0_drawings/sb77p044.jpg 0_drawings/sb77p044.jpg 0_drawings 0 True /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/10_SIMPLE_CROP/0_drawings/sb77p044.jpg /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/03_VISUAL_HAND_LABELED/0_drawings/sb77p044.jpg -0.3477007,-0.5714155,-0.73929733,-0.6553513,-0.6254566,-0.65341413,-0.7267234,-0.4896673,-0.7537334,-0.14662892,-0.43905735,-0.64813715,0.059202433,-0.6266761,-0.51404697,-0.20505324,-0.5467274,-0.6520286,1.2549256,-0.6497359,-0.64108604,-0.55193967,-0.5446661,-0.6779002,-0.41643643,-0.6690378,-0.22824319,-0.5982413,-0.73986673,-0.3338361,-0.68509877,0.10866904,-0.1451351,-0.4592305,0.5446466,0.7924262,-0.73933,-0.57338566,-0.45801556,-0.11409092,-0.4252534,0.4120332,-0.6189488,-0.28175777,2.210379,-0.59257406,-0.070759535,-0.6001429,-0.651804,0.012511611,0.26820052,-0.66552746,0.9221995,...

5 rows × 21 columns

watercolors_tsv_fname = f"{preprocessing_dir}/watercolors.tsv"
watercolors_df.to_csv(
    watercolors_tsv_fname, index=True, index_label="idx", sep="\t", header=True
)
watercolor_df = pd.read_csv(watercolors_tsv_fname, delimiter="\t", index_col="idx")
watercolor_df.head()
abs_fname rel_fname label pred_label pred_idx pred_probs emb_csv cluster cluster_dist metacluster ... indiv_fname visual_rel_path visual_abs_path handlabeled_rel_path handlabeled_metacluster_name handlabeled_metacluster_id handlabeled_metacluster_was_correct preprocessed_abs_path handlabeled_abs_path emb_csv_cropped
idx
0 /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/01_FLAT/art/sb07p104.jpg art/sb07p104.jpg art xtra 4 0.177406,0.008799,0.008245,0.017177,0.788373 -0.39105213,0.96309596,-0.73929733,0.4489988,0.8297614,-0.3937308,-0.7267234,-0.32461396,-0.7537334,-0.42715576,-0.62038505,-0.72562873,0.3037846,-0.6266761,-0.5213815,-0.31669965,-0.5467274,-0.6520286,-0.22544897,-0.6497359,-0.64108604,0.6374447,-0.5446661,-0.6779002,-0.14143991,-0.6690378,-0.44753593,0.66945183,-0.73986673,-0.45211998,-0.05996394,-0.21525535,0.82928157,-0.04412651,-0.600525,-0.04148197,-0.73825717,-0.57338566,-0.25227422,2.3566113,-0.61049384,1.0027854,-0.40134108,1.3733256,-0.75794554,-0.59257406,-0.4395525,-0.6001429,1.0358506,1.1911299,0.8162154,0.032713354,-0.6482407... 5 238.33170 1 ... sb07p104.jpg 1_watercolors/sb07p104.jpg /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/02_VISUAL_CATEGORIES/1_watercolors/sb07p104.jpg 1_watercolors/sb07p104.jpg 1_watercolors 1 True /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/10_SIMPLE_CROP/1_watercolors/sb07p104.jpg /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/03_VISUAL_HAND_LABELED/1_watercolors/sb07p104.jpg -0.6198182,0.8895926,-0.73929733,0.6418346,0.46164584,1.0085131,-0.7267234,-0.4896673,-0.7537334,-0.42715576,-0.62038505,-0.72562873,1.4399182,-0.6266761,0.474914,-0.57515705,-0.5467274,-0.6520286,1.2274435,-0.6497359,-0.27622125,-0.45870692,-0.5446661,-0.6779002,1.3343718,-0.6690378,-0.4518578,0.42277813,-0.73986673,-0.45211998,1.6291834,-0.67007643,-0.09817025,-0.00090405345,-0.600525,-0.6186755,-0.73933,-0.57338566,0.006386578,1.034553,-0.61049384,-0.58021957,-0.09483403,0.78779536,-0.73080033,0.10947651,0.3367887,-0.5382227,-0.26548737,0.5630663,2.15088,0.2266624,-0.6482407,0.049348265...
1 /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/01_FLAT/art/sb31p017.jpg art/sb31p017.jpg art xtra 4 0.172119,0.008924,0.008226,0.016950,0.793781 -0.05104202,-0.3935787,-0.73929733,0.86878717,-0.6254566,-0.65341413,-0.7267234,-0.4896673,-0.7537334,-0.14799604,-0.62038505,-0.72562873,-0.2654881,-0.6266761,-0.68991846,-0.57515705,-0.41532665,-0.6520286,-0.6898426,-0.34099144,-0.64108604,-0.55193967,-0.5446661,-0.6779002,-0.2674706,-0.53598946,-0.13334358,-0.5982413,-0.73986673,-0.45211998,-0.68509877,0.033780396,-0.52171326,0.054827005,-0.20721096,0.3301326,-0.73933,-0.57338566,0.34032136,-0.6179389,-0.20170414,0.16225064,-0.44437563,0.44581896,-0.069196045,0.20976627,-0.07846111,-0.6001429,0.38122594,-0.09738222,-0.59497476,-0.665527... 11 191.66959 1 ... sb31p017.jpg 1_watercolors/sb31p017.jpg /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/02_VISUAL_CATEGORIES/1_watercolors/sb31p017.jpg 1_watercolors/sb31p017.jpg 1_watercolors 1 True /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/10_SIMPLE_CROP/1_watercolors/sb31p017.jpg /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/03_VISUAL_HAND_LABELED/1_watercolors/sb31p017.jpg 1.491735,-0.5714155,-0.73929733,0.05867392,0.5154146,0.0936929,-0.7267234,-0.4896673,0.4246894,-0.42715576,-0.33477074,-0.72562873,1.2274611,-0.6266761,-0.68991846,-0.57515705,-0.5467274,1.1312869,-0.06054777,-0.028933167,-0.64108604,-0.55193967,-0.5446661,-0.6779002,-0.57759243,0.46393585,0.4817328,0.22738433,-0.73986673,-0.45211998,0.0057709217,-0.67007643,-0.52171326,0.68283725,0.060967267,0.7253895,-0.73933,-0.57338566,-0.65925777,-0.6179389,-0.32987997,0.86336035,-0.6189488,1.3613329,1.2250904,-0.59257406,-0.5857397,-0.6001429,-0.5687719,-0.14814761,0.5325973,-0.66552746,-0.6482407,0....
2 /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/01_FLAT/art/sb05p079.jpg art/sb05p079.jpg art xtra 4 0.172158,0.008873,0.008536,0.017017,0.793416 1.8089037,-0.5714155,-0.73929733,-0.10773122,-0.22753507,0.34884918,0.124596715,-0.4896673,-0.27447522,-0.42715576,0.61659455,-0.03226477,-0.662768,-0.6266761,-0.68991846,-0.57515705,-0.39897114,-0.6520286,-0.6898426,-0.6497359,0.16184372,-0.55193967,-0.5446661,-0.6779002,0.04647112,-0.6690378,-0.4518578,0.9576235,0.29423904,-0.45211998,-0.68509877,0.09260088,-0.3948297,-0.4592305,-0.600525,-0.6186755,-0.64046603,-0.57338566,0.08902073,0.09568572,-0.61049384,0.7515181,-0.15892029,-0.4098586,1.8483992,-0.59257406,-0.6157326,-0.56642026,-0.651804,-0.44185895,-0.19970179,0.19587982,1.3608505,... 11 140.32997 1 ... sb05p079.jpg 1_watercolors/sb05p079.jpg /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/02_VISUAL_CATEGORIES/1_watercolors/sb05p079.jpg 1_watercolors/sb05p079.jpg 1_watercolors 1 NaN /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/10_SIMPLE_CROP/1_watercolors/sb05p079.jpg /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/03_VISUAL_HAND_LABELED/1_watercolors/sb05p079.jpg -0.6013173,-0.5714155,-0.7368871,-0.6553513,-0.6254566,-0.65341413,0.071327925,-0.4896673,-0.7537334,-0.29406685,1.2854458,-0.72562873,1.4279991,-0.2084853,0.4439276,-0.57515705,-0.5467274,-0.2426523,0.6567551,-0.6497359,0.284827,-0.55193967,-0.5446661,-0.6779002,-0.57759243,-0.6690378,0.39760548,-0.5982413,-0.16403872,0.82081807,-0.68509877,-0.67007643,-0.16007048,-0.23898152,0.4340614,-0.6186755,-0.73933,-0.57338566,-0.65925777,-0.60700464,-0.22504222,1.2887287,0.17025876,-0.5827259,3.245521,-0.59257406,1.607188,-0.6001429,-0.1800242,-0.5315948,0.2059763,0.33526373,0.109642506,-0.0013180...
3 /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/01_FLAT/art/sb26p082.jpg art/sb26p082.jpg art xtra 4 0.179525,0.008828,0.008282,0.017196,0.786169 1.8392665,0.3796271,-0.73929733,0.82189727,1.6830277,0.9302285,-0.5532687,-0.4896673,-0.30764756,-0.42715576,-0.44450876,-0.72562873,-0.662768,0.54702616,-0.68991846,-0.57515705,-0.31611928,-0.59368926,1.2819774,-0.6497359,-0.64108604,-0.55193967,0.84984857,-0.6779002,-0.06536412,-0.6690378,0.34403068,-0.16627067,0.3990196,-0.45211998,0.65170527,-0.67007643,0.6049255,-0.4367706,-0.600525,-0.0046679974,-0.73933,-0.109048486,-0.65925777,0.65358853,-0.61049384,0.70374626,-0.6189488,-0.6682474,-0.0177418,-0.59257406,1.1068444,-0.29651338,-0.651804,-0.5315948,1.8200746,-0.66552746,0.11623299,-0... 7 176.11029 1 ... sb26p082.jpg 1_watercolors/sb26p082.jpg /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/02_VISUAL_CATEGORIES/1_watercolors/sb26p082.jpg 1_watercolors/sb26p082.jpg 1_watercolors 1 NaN /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/10_SIMPLE_CROP/1_watercolors/sb26p082.jpg /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/03_VISUAL_HAND_LABELED/1_watercolors/sb26p082.jpg 0.8175719,0.48385304,-0.73929733,1.0291914,1.4682066,1.225123,-0.43518582,-0.4896673,-0.7537334,-0.42715576,0.72162604,-0.72562873,-0.662768,-0.6266761,-0.55470747,-0.57515705,-0.5467274,-0.6520286,2.099903,-0.6497359,-0.64108604,-0.55193967,1.3572993,-0.6779002,1.3149762,0.8512635,0.81857395,-0.5982413,0.056738913,-0.45211998,2.0946088,-0.67007643,-0.52171326,-0.4592305,-0.600525,1.1100725,-0.73933,-0.57338566,-0.24140868,0.9004108,-0.61049384,0.4742828,-0.6189488,-0.6682474,0.335356,0.40166396,0.7790335,-0.6001429,-0.651804,-0.4778452,0.7360641,-0.66552746,-0.6482407,-0.13845,-0.7311095,...
4 /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/01_FLAT/art/sb69p101-color.jpg art/sb69p101-color.jpg art xtra 4 0.179525,0.008828,0.008282,0.017196,0.786169 -0.23259398,-0.5714155,-0.73929733,-0.6553513,0.34417403,1.046661,-0.42288247,-0.4896673,0.39017296,-0.42715576,-0.62038505,-0.72562873,-0.662768,-0.6266761,0.93892807,-0.57515705,-0.5222921,-0.6520286,-0.6898426,-0.6497359,-0.6366938,-0.55193967,-0.5446661,-0.6779002,-0.46687827,-0.6690378,-0.4518578,-0.5982413,0.7252437,-0.45211998,1.8137504,-0.67007643,-0.52171326,-0.36457688,-0.600525,0.8178272,-0.73933,0.23574609,-0.65925777,-0.6179389,-0.61049384,-0.15158218,-0.41958112,-0.6682474,-0.75794554,0.4943592,0.8210626,-0.6001429,-0.651804,-0.080083996,0.48374963,-0.42743486,-0.6482407,-0.4... 7 187.45346 1 ... sb69p101-color.jpg 1_watercolors/sb69p101-color.jpg /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/02_VISUAL_CATEGORIES/1_watercolors/sb69p101-color.jpg 1_watercolors/sb69p101-color.jpg 1_watercolors 1 NaN /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/10_SIMPLE_CROP/1_watercolors/sb69p101-color.jpg /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/03_VISUAL_HAND_LABELED/1_watercolors/sb69p101-color.jpg 0.14908737,-0.5714155,-0.73929733,0.44245207,-0.6254566,1.4611686,-0.7267234,-0.4896673,0.87923527,-0.42715576,-0.62038505,-0.72562873,-0.662768,-0.6266761,0.4918049,-0.57515705,-0.5467274,-0.6520286,-0.6898426,-0.2860955,-0.64108604,-0.55193967,-0.5446661,-0.6779002,0.69009775,-0.6690378,-0.4518578,0.18292433,-0.004632473,-0.45211998,1.7543458,-0.67007643,-0.52171326,-0.41669255,-0.600525,1.4654884,0.5742926,-0.57338566,-0.65925777,-0.6179389,-0.52983093,0.26484245,-0.25630984,-0.6682474,0.19898295,0.95297796,0.38033813,-0.6001429,-0.651804,-0.5315948,1.3264011,0.31547034,-0.6482407,-0.47...

5 rows × 21 columns

drawings_emb = np.stack(
    [np.array([float(f) for f in s.split(",")]) for s in list(drawings_df.emb_csv)]
).astype(np.float32)

drawings_cropped_emb = np.stack(
    [
        np.array([float(f) for f in s.split(",")])
        for s in list(drawings_df.emb_csv_cropped)
    ]
).astype(np.float32)

drawings_emb.shape, drawings_cropped_emb.shape
((1923, 512), (1923, 512))
watercolors_emb = np.stack(
    [np.array([float(f) for f in s.split(",")]) for s in list(watercolors_df.emb_csv)]
).astype(np.float32)

watercolors_cropped_emb = np.stack(
    [
        np.array([float(f) for f in s.split(",")])
        for s in list(watercolors_df.emb_csv_cropped)
    ]
).astype(np.float32)

watercolors_emb.shape, watercolors_cropped_emb.shape
((404, 512), (404, 512))
drawings_X_tsne = TSNE(n_components=2, random_state=42).fit_transform(drawings_emb)
fig = plt.scatter(
    x=drawings_X_tsne[:, 0], y=drawings_X_tsne[:, 1], c=drawings_df.cluster, s=2.0
)

drawings_cropped_X_tsne = TSNE(n_components=2, random_state=42).fit_transform(
    drawings_cropped_emb
)
fig = plt.scatter(
    x=drawings_cropped_X_tsne[:, 0],
    y=drawings_cropped_X_tsne[:, 1],
    c=drawings_df.cluster,
    s=2.0,
)

drawings_index = faiss.IndexFlatL2(emb_dim)
drawings_index.add(drawings_emb)

drawings_cropped_index = faiss.IndexFlatL2(emb_dim)
drawings_cropped_index.add(drawings_cropped_emb)
watercolors_X_tsne = TSNE(n_components=2, random_state=42).fit_transform(
    watercolors_emb
)
fig = plt.scatter(
    x=watercolors_X_tsne[:, 0],
    y=watercolors_X_tsne[:, 1],
    c=watercolors_df.cluster,
    s=5.0,
)

watercolors_cropped_X_tsne = TSNE(n_components=2, random_state=42).fit_transform(
    watercolors_cropped_emb
)
fig = plt.scatter(
    x=watercolors_cropped_X_tsne[:, 0],
    y=watercolors_cropped_X_tsne[:, 1],
    c=watercolors_df.cluster,
    s=5.0,
)

watercolors_index = faiss.IndexFlatL2(emb_dim)
watercolors_index.add(watercolors_emb)

watercolors_cropped_index = faiss.IndexFlatL2(emb_dim)
watercolors_cropped_index.add(watercolors_cropped_emb)

drawings_emb

drawings_df.head()
abs_fname rel_fname label pred_label pred_idx pred_probs emb_csv cluster cluster_dist metacluster ... visual_rel_path visual_abs_path handlabeled_rel_path handlabeled_metacluster_name handlabeled_metacluster_id handlabeled_metacluster_was_correct preprocessed_abs_path handlabeled_abs_path emb_csv_cropped drawings_cluster_id
0 /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/01_FLAT/art/sb77p043.jpg art/sb77p043.jpg art xtra 4 0.168532,0.008473,0.008068,0.016940,0.797986 -0.6198182,-0.5714155,-0.6871516,-0.6553513,-0.6254566,-0.65341413,-0.7267234,-0.4896673,-0.7537334,-0.42715576,1.4904574,-0.72562873,-0.662768,-0.6266761,0.6913696,0.054546177,-0.5467274,-0.6520286,0.117179275,0.94330966,0.5815062,-0.55193967,-0.5446661,-0.6779002,-0.57759243,-0.4584825,-0.3818994,-0.5750927,-0.73986673,-0.45211998,-0.6141643,-0.67007643,-0.52171326,-0.4592305,1.4788612,-0.6186755,0.799198,-0.57338566,-0.17778617,0.10336053,0.093812525,0.17924881,-0.6189488,-0.6682474,2.1040225,-0.59257406,1.6553459,-0.6001429,0.5109105,0.19352531,-0.2517513,-0.66552746,-0.6482407,-0.4732... 11 199.22961 1 ... 1_watercolors/sb77p043.jpg /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/02_VISUAL_CATEGORIES/1_watercolors/sb77p043.jpg 0_drawings/sb77p043.jpg 0_drawings 0 False /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/10_SIMPLE_CROP/0_drawings/sb77p043.jpg /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/03_VISUAL_HAND_LABELED/0_drawings/sb77p043.jpg -0.6198182,-0.5714155,0.2937309,0.2691822,-0.6254566,-0.46855158,-0.7267234,-0.4896673,-0.7537334,-0.42715576,2.241211,-0.013144195,-0.30681813,-0.6266761,0.43516117,-0.57515705,-0.5467274,-0.5245168,1.3334948,2.1400952,-0.64108604,-0.55193967,-0.5446661,-0.6779002,-0.57759243,-0.6690378,0.38178188,-0.5982413,-0.50063276,-0.21540937,0.4948988,-0.67007643,-0.52171326,-0.4592305,1.8570362,-0.6186755,0.94023055,-0.57338566,0.5270257,-0.6179389,2.302543,1.1004333,0.15528035,-0.6682474,1.890626,-0.59257406,1.331521,-0.6001429,1.5220151,0.93749076,-0.59497476,-0.66552746,-0.6482407,-0.4732165,0.... 3
1 /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/01_FLAT/art/sb67p021.jpg art/sb67p021.jpg art xtra 4 0.170976,0.008673,0.008480,0.017028,0.794843 1.1073987,0.3512016,-0.73929733,-0.6553513,1.7477593,-0.65341413,0.32179314,-0.4896673,-0.1797334,-0.42715576,1.3163843,-0.72562873,-0.61387855,-0.6266761,-0.35361218,0.37611246,-0.08771938,-0.5262803,0.9261699,-0.6497359,-0.64108604,-0.55193967,-0.5446661,-0.6779002,-0.32559583,-0.6690378,-0.4518578,0.51828945,-0.4238917,-0.45211998,-0.16527033,-0.67007643,1.0136865,-0.4592305,-0.600525,-0.060860336,-0.19446748,-0.24127388,2.2282472,1.8003348,-0.61049384,0.39795423,0.2626753,-0.6682474,-0.75794554,-0.59257406,0.80257696,-0.6001429,-0.651804,-0.028328001,0.53641737,-0.6501347,-0.6482407,0.... 3 132.26111 0 ... 0_drawings/sb67p021.jpg /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/02_VISUAL_CATEGORIES/0_drawings/sb67p021.jpg 0_drawings/sb67p021.jpg 0_drawings 0 True /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/10_SIMPLE_CROP/0_drawings/sb67p021.jpg /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/03_VISUAL_HAND_LABELED/0_drawings/sb67p021.jpg -0.20756221,-0.24843562,0.29454154,-0.6553513,-0.6254566,-0.65341413,-0.7267234,-0.4896673,-0.7537334,-0.42715576,0.9697293,-0.72562873,-0.662768,-0.6266761,-0.23836556,0.4814458,-0.5467274,-0.6520286,0.838902,-0.6497359,-0.57338166,-0.55193967,-0.5446661,-0.28419846,1.6012006,-0.6690378,-0.4518578,-0.0104218125,-0.73986673,-0.3002332,-0.68509877,-0.67007643,-0.36297536,-0.4592305,-0.600525,-0.6186755,-0.73933,-0.57338566,-0.65925777,1.6904012,-0.61049384,-0.58021957,0.508085,0.14767355,0.8082305,-0.59257406,-0.6157326,-0.6001429,-0.651804,-0.30467254,0.17396247,-0.66552746,-0.6482407,-0.0... 2
2 /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/01_FLAT/art/sb25p227.jpg art/sb25p227.jpg art xtra 4 0.158396,0.008277,0.007424,0.016584,0.809319 1.3776337,-0.5714155,-0.2587232,-0.6553513,1.3532461,-0.65341413,-0.7267234,-0.4896673,-0.7537334,-0.25077122,0.050992966,-0.72562873,0.1406585,-0.6266761,1.0653365,0.96198404,-0.5467274,0.30261123,0.6327609,-0.6497359,-0.64108604,-0.28434965,-0.35651857,-0.6779002,-0.28245115,-0.6690378,-0.4518578,0.030088186,-0.73986673,-0.18931103,-0.041653574,-0.67007643,-0.52171326,-0.29881266,-0.600525,-0.23231092,-0.73933,-0.57338566,-0.65925777,1.8833572,-0.61049384,0.44560486,0.14075392,-0.6682474,-0.75794554,-0.59257406,-0.07511848,-0.6001429,-0.651804,-0.5315948,0.023931146,0.723624,-0.6482407,-... 8 188.58075 0 ... 0_drawings/sb25p227.jpg /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/02_VISUAL_CATEGORIES/0_drawings/sb25p227.jpg 0_drawings/sb25p227.jpg 0_drawings 0 True /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/10_SIMPLE_CROP/0_drawings/sb25p227.jpg /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/03_VISUAL_HAND_LABELED/0_drawings/sb25p227.jpg -0.6198182,-0.428226,-0.73929733,-0.6553513,-0.49369657,-0.65341413,-0.7267234,-0.4896673,-0.7537334,-0.28293163,-0.62038505,-0.32824886,2.5504894,-0.6266761,0.8397537,0.85716057,-0.5467274,-0.058725297,0.64954805,-0.6497359,-0.64108604,-0.36876833,-0.5446661,-0.29563427,0.08626467,-0.6690378,-0.4518578,0.64337015,-0.73986673,0.018805295,-0.68509877,-0.67007643,1.5876667,-0.4592305,-0.600525,-0.6186755,0.28688914,-0.57338566,-0.65925777,1.6810645,-0.61049384,1.8564332,-0.6189488,-0.6682474,-0.75794554,-0.59257406,-0.6157326,-0.6001429,-0.63579994,-0.45296612,-0.29925343,-0.0263654,-0.64824... 3
3 /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/01_FLAT/art/sb48p057.jpg art/sb48p057.jpg art xtra 4 0.165322,0.008453,0.008010,0.016587,0.801628 2.4936543,0.17563903,-0.6522293,-0.55642915,1.1084181,-0.5028205,-0.046447277,-0.4896673,-0.7537334,-0.42715576,0.84124434,-0.72562873,-0.52445275,-0.5557985,-0.21369287,2.2372599,-0.26381853,-0.6520286,-0.6898426,-0.6497359,-0.64108604,0.43080842,-0.23286673,-0.6779002,0.7969176,-0.6690378,-0.4518578,0.747658,0.04896885,-0.45211998,-0.68509877,-0.2462106,0.7319356,-0.4592305,-0.600525,-0.6186755,-0.5338096,-0.57338566,1.1886733,0.04046011,-0.61049384,0.45326668,0.72983754,-0.6682474,-0.10000485,0.034278154,-0.33160114,-0.6001429,-0.651804,-0.5315948,-0.20898154,-0.66552746,1.2346795,-0.47... 14 90.26291 0 ... 0_drawings/sb48p057.jpg /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/02_VISUAL_CATEGORIES/0_drawings/sb48p057.jpg 0_drawings/sb48p057.jpg 0_drawings 0 True /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/10_SIMPLE_CROP/0_drawings/sb48p057.jpg /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/03_VISUAL_HAND_LABELED/0_drawings/sb48p057.jpg -0.34353483,-0.5714155,2.2665114,-0.6553513,-0.42076486,-0.6254998,-0.7267234,-0.4896673,-0.7537334,-0.42715576,0.6137707,-0.72562873,0.2611376,1.0485492,0.91806084,-0.452704,-0.5467274,-0.6520286,0.621349,-0.6497359,-0.64108604,-0.55193967,-0.5446661,-0.6779002,0.7967064,0.011958599,-0.4518578,-0.25104153,-0.6493137,-0.45211998,-0.02894944,-0.67007643,1.3037661,-0.4592305,-0.600525,-0.6186755,-0.072172046,-0.57338566,0.42140257,0.8994249,-0.61049384,-0.35844505,-0.03452295,-0.40064916,0.1334514,-0.59257406,-0.06328797,-0.6001429,-0.651804,-0.5315948,0.55393887,-0.66552746,-0.6482407,0.165... 4
4 /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/01_FLAT/art/sb77p044.jpg art/sb77p044.jpg art xtra 4 0.171638,0.008182,0.008061,0.016469,0.795650 2.170152,-0.01916939,-0.47766963,-0.6553513,-0.44795185,-0.65341413,1.5596724,-0.4896673,-0.7537334,-0.42715576,1.0671424,-0.72562873,1.8207353,-0.6266761,-0.6194963,1.1724913,-0.5467274,0.12343103,1.5514618,-0.6497359,0.23890108,-0.55193967,-0.5446661,-0.6779002,-0.57759243,0.33040416,-0.4518578,0.39869583,0.120936334,-0.45211998,-0.68509877,0.2514736,0.17836922,-0.4592305,-0.600525,-0.6186755,-0.73933,-0.57338566,1.3668395,0.6006557,1.2428443,1.0844817,0.36636358,0.48543411,-0.5954572,-0.59257406,-0.30289415,1.2783914,0.5800507,-0.23473695,-0.59497476,-0.66552746,2.2758756,-0.4732165,-0.... 4 176.29102 0 ... 0_drawings/sb77p044.jpg /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/02_VISUAL_CATEGORIES/0_drawings/sb77p044.jpg 0_drawings/sb77p044.jpg 0_drawings 0 True /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/10_SIMPLE_CROP/0_drawings/sb77p044.jpg /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/03_VISUAL_HAND_LABELED/0_drawings/sb77p044.jpg -0.3477007,-0.5714155,-0.73929733,-0.6553513,-0.6254566,-0.65341413,-0.7267234,-0.4896673,-0.7537334,-0.14662892,-0.43905735,-0.64813715,0.059202433,-0.6266761,-0.51404697,-0.20505324,-0.5467274,-0.6520286,1.2549256,-0.6497359,-0.64108604,-0.55193967,-0.5446661,-0.6779002,-0.41643643,-0.6690378,-0.22824319,-0.5982413,-0.73986673,-0.3338361,-0.68509877,0.10866904,-0.1451351,-0.4592305,0.5446466,0.7924262,-0.73933,-0.57338566,-0.45801556,-0.11409092,-0.4252534,0.4120332,-0.6189488,-0.28175777,2.210379,-0.59257406,-0.070759535,-0.6001429,-0.651804,0.012511611,0.26820052,-0.66552746,0.9221995,... 0

5 rows × 22 columns

drawings_df = drawings_df.reindex()
drawings_df.head()
abs_fname rel_fname label pred_label pred_idx pred_probs emb_csv cluster cluster_dist metacluster ... visual_rel_path visual_abs_path handlabeled_rel_path handlabeled_metacluster_name handlabeled_metacluster_id handlabeled_metacluster_was_correct preprocessed_abs_path handlabeled_abs_path emb_csv_cropped drawings_cluster_id
0 /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/01_FLAT/art/sb77p043.jpg art/sb77p043.jpg art xtra 4 0.168532,0.008473,0.008068,0.016940,0.797986 -0.6198182,-0.5714155,-0.6871516,-0.6553513,-0.6254566,-0.65341413,-0.7267234,-0.4896673,-0.7537334,-0.42715576,1.4904574,-0.72562873,-0.662768,-0.6266761,0.6913696,0.054546177,-0.5467274,-0.6520286,0.117179275,0.94330966,0.5815062,-0.55193967,-0.5446661,-0.6779002,-0.57759243,-0.4584825,-0.3818994,-0.5750927,-0.73986673,-0.45211998,-0.6141643,-0.67007643,-0.52171326,-0.4592305,1.4788612,-0.6186755,0.799198,-0.57338566,-0.17778617,0.10336053,0.093812525,0.17924881,-0.6189488,-0.6682474,2.1040225,-0.59257406,1.6553459,-0.6001429,0.5109105,0.19352531,-0.2517513,-0.66552746,-0.6482407,-0.4732... 11 199.22961 1 ... 1_watercolors/sb77p043.jpg /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/02_VISUAL_CATEGORIES/1_watercolors/sb77p043.jpg 0_drawings/sb77p043.jpg 0_drawings 0 False /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/10_SIMPLE_CROP/0_drawings/sb77p043.jpg /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/03_VISUAL_HAND_LABELED/0_drawings/sb77p043.jpg -0.6198182,-0.5714155,0.2937309,0.2691822,-0.6254566,-0.46855158,-0.7267234,-0.4896673,-0.7537334,-0.42715576,2.241211,-0.013144195,-0.30681813,-0.6266761,0.43516117,-0.57515705,-0.5467274,-0.5245168,1.3334948,2.1400952,-0.64108604,-0.55193967,-0.5446661,-0.6779002,-0.57759243,-0.6690378,0.38178188,-0.5982413,-0.50063276,-0.21540937,0.4948988,-0.67007643,-0.52171326,-0.4592305,1.8570362,-0.6186755,0.94023055,-0.57338566,0.5270257,-0.6179389,2.302543,1.1004333,0.15528035,-0.6682474,1.890626,-0.59257406,1.331521,-0.6001429,1.5220151,0.93749076,-0.59497476,-0.66552746,-0.6482407,-0.4732165,0.... 3
1 /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/01_FLAT/art/sb67p021.jpg art/sb67p021.jpg art xtra 4 0.170976,0.008673,0.008480,0.017028,0.794843 1.1073987,0.3512016,-0.73929733,-0.6553513,1.7477593,-0.65341413,0.32179314,-0.4896673,-0.1797334,-0.42715576,1.3163843,-0.72562873,-0.61387855,-0.6266761,-0.35361218,0.37611246,-0.08771938,-0.5262803,0.9261699,-0.6497359,-0.64108604,-0.55193967,-0.5446661,-0.6779002,-0.32559583,-0.6690378,-0.4518578,0.51828945,-0.4238917,-0.45211998,-0.16527033,-0.67007643,1.0136865,-0.4592305,-0.600525,-0.060860336,-0.19446748,-0.24127388,2.2282472,1.8003348,-0.61049384,0.39795423,0.2626753,-0.6682474,-0.75794554,-0.59257406,0.80257696,-0.6001429,-0.651804,-0.028328001,0.53641737,-0.6501347,-0.6482407,0.... 3 132.26111 0 ... 0_drawings/sb67p021.jpg /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/02_VISUAL_CATEGORIES/0_drawings/sb67p021.jpg 0_drawings/sb67p021.jpg 0_drawings 0 True /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/10_SIMPLE_CROP/0_drawings/sb67p021.jpg /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/03_VISUAL_HAND_LABELED/0_drawings/sb67p021.jpg -0.20756221,-0.24843562,0.29454154,-0.6553513,-0.6254566,-0.65341413,-0.7267234,-0.4896673,-0.7537334,-0.42715576,0.9697293,-0.72562873,-0.662768,-0.6266761,-0.23836556,0.4814458,-0.5467274,-0.6520286,0.838902,-0.6497359,-0.57338166,-0.55193967,-0.5446661,-0.28419846,1.6012006,-0.6690378,-0.4518578,-0.0104218125,-0.73986673,-0.3002332,-0.68509877,-0.67007643,-0.36297536,-0.4592305,-0.600525,-0.6186755,-0.73933,-0.57338566,-0.65925777,1.6904012,-0.61049384,-0.58021957,0.508085,0.14767355,0.8082305,-0.59257406,-0.6157326,-0.6001429,-0.651804,-0.30467254,0.17396247,-0.66552746,-0.6482407,-0.0... 2
2 /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/01_FLAT/art/sb25p227.jpg art/sb25p227.jpg art xtra 4 0.158396,0.008277,0.007424,0.016584,0.809319 1.3776337,-0.5714155,-0.2587232,-0.6553513,1.3532461,-0.65341413,-0.7267234,-0.4896673,-0.7537334,-0.25077122,0.050992966,-0.72562873,0.1406585,-0.6266761,1.0653365,0.96198404,-0.5467274,0.30261123,0.6327609,-0.6497359,-0.64108604,-0.28434965,-0.35651857,-0.6779002,-0.28245115,-0.6690378,-0.4518578,0.030088186,-0.73986673,-0.18931103,-0.041653574,-0.67007643,-0.52171326,-0.29881266,-0.600525,-0.23231092,-0.73933,-0.57338566,-0.65925777,1.8833572,-0.61049384,0.44560486,0.14075392,-0.6682474,-0.75794554,-0.59257406,-0.07511848,-0.6001429,-0.651804,-0.5315948,0.023931146,0.723624,-0.6482407,-... 8 188.58075 0 ... 0_drawings/sb25p227.jpg /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/02_VISUAL_CATEGORIES/0_drawings/sb25p227.jpg 0_drawings/sb25p227.jpg 0_drawings 0 True /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/10_SIMPLE_CROP/0_drawings/sb25p227.jpg /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/03_VISUAL_HAND_LABELED/0_drawings/sb25p227.jpg -0.6198182,-0.428226,-0.73929733,-0.6553513,-0.49369657,-0.65341413,-0.7267234,-0.4896673,-0.7537334,-0.28293163,-0.62038505,-0.32824886,2.5504894,-0.6266761,0.8397537,0.85716057,-0.5467274,-0.058725297,0.64954805,-0.6497359,-0.64108604,-0.36876833,-0.5446661,-0.29563427,0.08626467,-0.6690378,-0.4518578,0.64337015,-0.73986673,0.018805295,-0.68509877,-0.67007643,1.5876667,-0.4592305,-0.600525,-0.6186755,0.28688914,-0.57338566,-0.65925777,1.6810645,-0.61049384,1.8564332,-0.6189488,-0.6682474,-0.75794554,-0.59257406,-0.6157326,-0.6001429,-0.63579994,-0.45296612,-0.29925343,-0.0263654,-0.64824... 3
3 /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/01_FLAT/art/sb48p057.jpg art/sb48p057.jpg art xtra 4 0.165322,0.008453,0.008010,0.016587,0.801628 2.4936543,0.17563903,-0.6522293,-0.55642915,1.1084181,-0.5028205,-0.046447277,-0.4896673,-0.7537334,-0.42715576,0.84124434,-0.72562873,-0.52445275,-0.5557985,-0.21369287,2.2372599,-0.26381853,-0.6520286,-0.6898426,-0.6497359,-0.64108604,0.43080842,-0.23286673,-0.6779002,0.7969176,-0.6690378,-0.4518578,0.747658,0.04896885,-0.45211998,-0.68509877,-0.2462106,0.7319356,-0.4592305,-0.600525,-0.6186755,-0.5338096,-0.57338566,1.1886733,0.04046011,-0.61049384,0.45326668,0.72983754,-0.6682474,-0.10000485,0.034278154,-0.33160114,-0.6001429,-0.651804,-0.5315948,-0.20898154,-0.66552746,1.2346795,-0.47... 14 90.26291 0 ... 0_drawings/sb48p057.jpg /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/02_VISUAL_CATEGORIES/0_drawings/sb48p057.jpg 0_drawings/sb48p057.jpg 0_drawings 0 True /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/10_SIMPLE_CROP/0_drawings/sb48p057.jpg /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/03_VISUAL_HAND_LABELED/0_drawings/sb48p057.jpg -0.34353483,-0.5714155,2.2665114,-0.6553513,-0.42076486,-0.6254998,-0.7267234,-0.4896673,-0.7537334,-0.42715576,0.6137707,-0.72562873,0.2611376,1.0485492,0.91806084,-0.452704,-0.5467274,-0.6520286,0.621349,-0.6497359,-0.64108604,-0.55193967,-0.5446661,-0.6779002,0.7967064,0.011958599,-0.4518578,-0.25104153,-0.6493137,-0.45211998,-0.02894944,-0.67007643,1.3037661,-0.4592305,-0.600525,-0.6186755,-0.072172046,-0.57338566,0.42140257,0.8994249,-0.61049384,-0.35844505,-0.03452295,-0.40064916,0.1334514,-0.59257406,-0.06328797,-0.6001429,-0.651804,-0.5315948,0.55393887,-0.66552746,-0.6482407,0.165... 4
4 /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/01_FLAT/art/sb77p044.jpg art/sb77p044.jpg art xtra 4 0.171638,0.008182,0.008061,0.016469,0.795650 2.170152,-0.01916939,-0.47766963,-0.6553513,-0.44795185,-0.65341413,1.5596724,-0.4896673,-0.7537334,-0.42715576,1.0671424,-0.72562873,1.8207353,-0.6266761,-0.6194963,1.1724913,-0.5467274,0.12343103,1.5514618,-0.6497359,0.23890108,-0.55193967,-0.5446661,-0.6779002,-0.57759243,0.33040416,-0.4518578,0.39869583,0.120936334,-0.45211998,-0.68509877,0.2514736,0.17836922,-0.4592305,-0.600525,-0.6186755,-0.73933,-0.57338566,1.3668395,0.6006557,1.2428443,1.0844817,0.36636358,0.48543411,-0.5954572,-0.59257406,-0.30289415,1.2783914,0.5800507,-0.23473695,-0.59497476,-0.66552746,2.2758756,-0.4732165,-0.... 4 176.29102 0 ... 0_drawings/sb77p044.jpg /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/02_VISUAL_CATEGORIES/0_drawings/sb77p044.jpg 0_drawings/sb77p044.jpg 0_drawings 0 True /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/10_SIMPLE_CROP/0_drawings/sb77p044.jpg /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/03_VISUAL_HAND_LABELED/0_drawings/sb77p044.jpg -0.3477007,-0.5714155,-0.73929733,-0.6553513,-0.6254566,-0.65341413,-0.7267234,-0.4896673,-0.7537334,-0.14662892,-0.43905735,-0.64813715,0.059202433,-0.6266761,-0.51404697,-0.20505324,-0.5467274,-0.6520286,1.2549256,-0.6497359,-0.64108604,-0.55193967,-0.5446661,-0.6779002,-0.41643643,-0.6690378,-0.22824319,-0.5982413,-0.73986673,-0.3338361,-0.68509877,0.10866904,-0.1451351,-0.4592305,0.5446466,0.7924262,-0.73933,-0.57338566,-0.45801556,-0.11409092,-0.4252534,0.4120332,-0.6189488,-0.28175777,2.210379,-0.59257406,-0.070759535,-0.6001429,-0.651804,0.012511611,0.26820052,-0.66552746,0.9221995,... 0

5 rows × 22 columns

ncentroids = 8
niter = 20
verbose = False
drawings_kmeans = faiss.Kmeans(
    drawings_emb.shape[1], ncentroids, niter=niter, verbose=verbose, gpu=True
)
drawings_kmeans.train(drawings_emb)
drawings_D, drawings_I = drawings_index.search(drawings_kmeans.centroids, 16)

drawings_kD, drawings_kI = drawings_kmeans.index.search(drawings_emb, 1)
drawings_df.loc[:, "drawings_cluster_id"] = drawings_kI
drawings_df.loc[:, "drawings_cluster_dist"] = drawings_kD
drawings_df.head()
abs_fname rel_fname label pred_label pred_idx pred_probs emb_csv cluster cluster_dist metacluster ... visual_abs_path handlabeled_rel_path handlabeled_metacluster_name handlabeled_metacluster_id handlabeled_metacluster_was_correct preprocessed_abs_path handlabeled_abs_path emb_csv_cropped drawings_cluster_id drawings_cluster_dist
0 /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/01_FLAT/art/sb77p043.jpg art/sb77p043.jpg art xtra 4 0.168532,0.008473,0.008068,0.016940,0.797986 -0.6198182,-0.5714155,-0.6871516,-0.6553513,-0.6254566,-0.65341413,-0.7267234,-0.4896673,-0.7537334,-0.42715576,1.4904574,-0.72562873,-0.662768,-0.6266761,0.6913696,0.054546177,-0.5467274,-0.6520286,0.117179275,0.94330966,0.5815062,-0.55193967,-0.5446661,-0.6779002,-0.57759243,-0.4584825,-0.3818994,-0.5750927,-0.73986673,-0.45211998,-0.6141643,-0.67007643,-0.52171326,-0.4592305,1.4788612,-0.6186755,0.799198,-0.57338566,-0.17778617,0.10336053,0.093812525,0.17924881,-0.6189488,-0.6682474,2.1040225,-0.59257406,1.6553459,-0.6001429,0.5109105,0.19352531,-0.2517513,-0.66552746,-0.6482407,-0.4732... 11 199.22961 1 ... /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/02_VISUAL_CATEGORIES/1_watercolors/sb77p043.jpg 0_drawings/sb77p043.jpg 0_drawings 0 False /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/10_SIMPLE_CROP/0_drawings/sb77p043.jpg /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/03_VISUAL_HAND_LABELED/0_drawings/sb77p043.jpg -0.6198182,-0.5714155,0.2937309,0.2691822,-0.6254566,-0.46855158,-0.7267234,-0.4896673,-0.7537334,-0.42715576,2.241211,-0.013144195,-0.30681813,-0.6266761,0.43516117,-0.57515705,-0.5467274,-0.5245168,1.3334948,2.1400952,-0.64108604,-0.55193967,-0.5446661,-0.6779002,-0.57759243,-0.6690378,0.38178188,-0.5982413,-0.50063276,-0.21540937,0.4948988,-0.67007643,-0.52171326,-0.4592305,1.8570362,-0.6186755,0.94023055,-0.57338566,0.5270257,-0.6179389,2.302543,1.1004333,0.15528035,-0.6682474,1.890626,-0.59257406,1.331521,-0.6001429,1.5220151,0.93749076,-0.59497476,-0.66552746,-0.6482407,-0.4732165,0.... 3 217.249588
1 /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/01_FLAT/art/sb67p021.jpg art/sb67p021.jpg art xtra 4 0.170976,0.008673,0.008480,0.017028,0.794843 1.1073987,0.3512016,-0.73929733,-0.6553513,1.7477593,-0.65341413,0.32179314,-0.4896673,-0.1797334,-0.42715576,1.3163843,-0.72562873,-0.61387855,-0.6266761,-0.35361218,0.37611246,-0.08771938,-0.5262803,0.9261699,-0.6497359,-0.64108604,-0.55193967,-0.5446661,-0.6779002,-0.32559583,-0.6690378,-0.4518578,0.51828945,-0.4238917,-0.45211998,-0.16527033,-0.67007643,1.0136865,-0.4592305,-0.600525,-0.060860336,-0.19446748,-0.24127388,2.2282472,1.8003348,-0.61049384,0.39795423,0.2626753,-0.6682474,-0.75794554,-0.59257406,0.80257696,-0.6001429,-0.651804,-0.028328001,0.53641737,-0.6501347,-0.6482407,0.... 3 132.26111 0 ... /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/02_VISUAL_CATEGORIES/0_drawings/sb67p021.jpg 0_drawings/sb67p021.jpg 0_drawings 0 True /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/10_SIMPLE_CROP/0_drawings/sb67p021.jpg /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/03_VISUAL_HAND_LABELED/0_drawings/sb67p021.jpg -0.20756221,-0.24843562,0.29454154,-0.6553513,-0.6254566,-0.65341413,-0.7267234,-0.4896673,-0.7537334,-0.42715576,0.9697293,-0.72562873,-0.662768,-0.6266761,-0.23836556,0.4814458,-0.5467274,-0.6520286,0.838902,-0.6497359,-0.57338166,-0.55193967,-0.5446661,-0.28419846,1.6012006,-0.6690378,-0.4518578,-0.0104218125,-0.73986673,-0.3002332,-0.68509877,-0.67007643,-0.36297536,-0.4592305,-0.600525,-0.6186755,-0.73933,-0.57338566,-0.65925777,1.6904012,-0.61049384,-0.58021957,0.508085,0.14767355,0.8082305,-0.59257406,-0.6157326,-0.6001429,-0.651804,-0.30467254,0.17396247,-0.66552746,-0.6482407,-0.0... 2 169.947693
2 /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/01_FLAT/art/sb25p227.jpg art/sb25p227.jpg art xtra 4 0.158396,0.008277,0.007424,0.016584,0.809319 1.3776337,-0.5714155,-0.2587232,-0.6553513,1.3532461,-0.65341413,-0.7267234,-0.4896673,-0.7537334,-0.25077122,0.050992966,-0.72562873,0.1406585,-0.6266761,1.0653365,0.96198404,-0.5467274,0.30261123,0.6327609,-0.6497359,-0.64108604,-0.28434965,-0.35651857,-0.6779002,-0.28245115,-0.6690378,-0.4518578,0.030088186,-0.73986673,-0.18931103,-0.041653574,-0.67007643,-0.52171326,-0.29881266,-0.600525,-0.23231092,-0.73933,-0.57338566,-0.65925777,1.8833572,-0.61049384,0.44560486,0.14075392,-0.6682474,-0.75794554,-0.59257406,-0.07511848,-0.6001429,-0.651804,-0.5315948,0.023931146,0.723624,-0.6482407,-... 8 188.58075 0 ... /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/02_VISUAL_CATEGORIES/0_drawings/sb25p227.jpg 0_drawings/sb25p227.jpg 0_drawings 0 True /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/10_SIMPLE_CROP/0_drawings/sb25p227.jpg /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/03_VISUAL_HAND_LABELED/0_drawings/sb25p227.jpg -0.6198182,-0.428226,-0.73929733,-0.6553513,-0.49369657,-0.65341413,-0.7267234,-0.4896673,-0.7537334,-0.28293163,-0.62038505,-0.32824886,2.5504894,-0.6266761,0.8397537,0.85716057,-0.5467274,-0.058725297,0.64954805,-0.6497359,-0.64108604,-0.36876833,-0.5446661,-0.29563427,0.08626467,-0.6690378,-0.4518578,0.64337015,-0.73986673,0.018805295,-0.68509877,-0.67007643,1.5876667,-0.4592305,-0.600525,-0.6186755,0.28688914,-0.57338566,-0.65925777,1.6810645,-0.61049384,1.8564332,-0.6189488,-0.6682474,-0.75794554,-0.59257406,-0.6157326,-0.6001429,-0.63579994,-0.45296612,-0.29925343,-0.0263654,-0.64824... 3 162.882431
3 /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/01_FLAT/art/sb48p057.jpg art/sb48p057.jpg art xtra 4 0.165322,0.008453,0.008010,0.016587,0.801628 2.4936543,0.17563903,-0.6522293,-0.55642915,1.1084181,-0.5028205,-0.046447277,-0.4896673,-0.7537334,-0.42715576,0.84124434,-0.72562873,-0.52445275,-0.5557985,-0.21369287,2.2372599,-0.26381853,-0.6520286,-0.6898426,-0.6497359,-0.64108604,0.43080842,-0.23286673,-0.6779002,0.7969176,-0.6690378,-0.4518578,0.747658,0.04896885,-0.45211998,-0.68509877,-0.2462106,0.7319356,-0.4592305,-0.600525,-0.6186755,-0.5338096,-0.57338566,1.1886733,0.04046011,-0.61049384,0.45326668,0.72983754,-0.6682474,-0.10000485,0.034278154,-0.33160114,-0.6001429,-0.651804,-0.5315948,-0.20898154,-0.66552746,1.2346795,-0.47... 14 90.26291 0 ... /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/02_VISUAL_CATEGORIES/0_drawings/sb48p057.jpg 0_drawings/sb48p057.jpg 0_drawings 0 True /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/10_SIMPLE_CROP/0_drawings/sb48p057.jpg /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/03_VISUAL_HAND_LABELED/0_drawings/sb48p057.jpg -0.34353483,-0.5714155,2.2665114,-0.6553513,-0.42076486,-0.6254998,-0.7267234,-0.4896673,-0.7537334,-0.42715576,0.6137707,-0.72562873,0.2611376,1.0485492,0.91806084,-0.452704,-0.5467274,-0.6520286,0.621349,-0.6497359,-0.64108604,-0.55193967,-0.5446661,-0.6779002,0.7967064,0.011958599,-0.4518578,-0.25104153,-0.6493137,-0.45211998,-0.02894944,-0.67007643,1.3037661,-0.4592305,-0.600525,-0.6186755,-0.072172046,-0.57338566,0.42140257,0.8994249,-0.61049384,-0.35844505,-0.03452295,-0.40064916,0.1334514,-0.59257406,-0.06328797,-0.6001429,-0.651804,-0.5315948,0.55393887,-0.66552746,-0.6482407,0.165... 4 94.257965
4 /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/01_FLAT/art/sb77p044.jpg art/sb77p044.jpg art xtra 4 0.171638,0.008182,0.008061,0.016469,0.795650 2.170152,-0.01916939,-0.47766963,-0.6553513,-0.44795185,-0.65341413,1.5596724,-0.4896673,-0.7537334,-0.42715576,1.0671424,-0.72562873,1.8207353,-0.6266761,-0.6194963,1.1724913,-0.5467274,0.12343103,1.5514618,-0.6497359,0.23890108,-0.55193967,-0.5446661,-0.6779002,-0.57759243,0.33040416,-0.4518578,0.39869583,0.120936334,-0.45211998,-0.68509877,0.2514736,0.17836922,-0.4592305,-0.600525,-0.6186755,-0.73933,-0.57338566,1.3668395,0.6006557,1.2428443,1.0844817,0.36636358,0.48543411,-0.5954572,-0.59257406,-0.30289415,1.2783914,0.5800507,-0.23473695,-0.59497476,-0.66552746,2.2758756,-0.4732165,-0.... 4 176.29102 0 ... /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/02_VISUAL_CATEGORIES/0_drawings/sb77p044.jpg 0_drawings/sb77p044.jpg 0_drawings 0 True /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/10_SIMPLE_CROP/0_drawings/sb77p044.jpg /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/03_VISUAL_HAND_LABELED/0_drawings/sb77p044.jpg -0.3477007,-0.5714155,-0.73929733,-0.6553513,-0.6254566,-0.65341413,-0.7267234,-0.4896673,-0.7537334,-0.14662892,-0.43905735,-0.64813715,0.059202433,-0.6266761,-0.51404697,-0.20505324,-0.5467274,-0.6520286,1.2549256,-0.6497359,-0.64108604,-0.55193967,-0.5446661,-0.6779002,-0.41643643,-0.6690378,-0.22824319,-0.5982413,-0.73986673,-0.3338361,-0.68509877,0.10866904,-0.1451351,-0.4592305,0.5446466,0.7924262,-0.73933,-0.57338566,-0.45801556,-0.11409092,-0.4252534,0.4120332,-0.6189488,-0.28175777,2.210379,-0.59257406,-0.070759535,-0.6001429,-0.651804,0.012511611,0.26820052,-0.66552746,0.9221995,... 0 173.559937

5 rows × 23 columns

show_all_clusters(clusters_df=drawings_df, clusters=drawings_I, title="drawings_emb")

fig = plt.scatter(
    x=drawings_X_tsne[:, 0],
    y=drawings_X_tsne[:, 1],
    c=drawings_df.drawings_cluster_id,
    s=2.0,
)

drawings_emb_cropped

ncentroids = 8
niter = 20
verbose = False
drawings_cropped_kmeans = faiss.Kmeans(
    drawings_cropped_emb.shape[1], ncentroids, niter=niter, verbose=verbose, gpu=True
)
drawings_cropped_kmeans.train(drawings_cropped_emb)
drawings_cropped_D, drawings_cropped_I = drawings_cropped_index.search(
    drawings_cropped_kmeans.centroids, 16
)

drawings_cropped_kD, drawings_cropped_kI = drawings_cropped_kmeans.index.search(
    drawings_cropped_emb, 1
)
drawings_df.loc[:, "drawings_cropped_cluster_id"] = drawings_cropped_kI
drawings_df.loc[:, "drawings_cropped_cluster_dist"] = drawings_cropped_kD
drawings_df.head()
abs_fname rel_fname label pred_label pred_idx pred_probs emb_csv cluster cluster_dist metacluster ... handlabeled_metacluster_name handlabeled_metacluster_id handlabeled_metacluster_was_correct preprocessed_abs_path handlabeled_abs_path emb_csv_cropped drawings_cluster_id drawings_cluster_dist drawings_cropped_cluster_id drawings_cropped_cluster_dist
0 /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/01_FLAT/art/sb77p043.jpg art/sb77p043.jpg art xtra 4 0.168532,0.008473,0.008068,0.016940,0.797986 -0.6198182,-0.5714155,-0.6871516,-0.6553513,-0.6254566,-0.65341413,-0.7267234,-0.4896673,-0.7537334,-0.42715576,1.4904574,-0.72562873,-0.662768,-0.6266761,0.6913696,0.054546177,-0.5467274,-0.6520286,0.117179275,0.94330966,0.5815062,-0.55193967,-0.5446661,-0.6779002,-0.57759243,-0.4584825,-0.3818994,-0.5750927,-0.73986673,-0.45211998,-0.6141643,-0.67007643,-0.52171326,-0.4592305,1.4788612,-0.6186755,0.799198,-0.57338566,-0.17778617,0.10336053,0.093812525,0.17924881,-0.6189488,-0.6682474,2.1040225,-0.59257406,1.6553459,-0.6001429,0.5109105,0.19352531,-0.2517513,-0.66552746,-0.6482407,-0.4732... 11 199.22961 1 ... 0_drawings 0 False /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/10_SIMPLE_CROP/0_drawings/sb77p043.jpg /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/03_VISUAL_HAND_LABELED/0_drawings/sb77p043.jpg -0.6198182,-0.5714155,0.2937309,0.2691822,-0.6254566,-0.46855158,-0.7267234,-0.4896673,-0.7537334,-0.42715576,2.241211,-0.013144195,-0.30681813,-0.6266761,0.43516117,-0.57515705,-0.5467274,-0.5245168,1.3334948,2.1400952,-0.64108604,-0.55193967,-0.5446661,-0.6779002,-0.57759243,-0.6690378,0.38178188,-0.5982413,-0.50063276,-0.21540937,0.4948988,-0.67007643,-0.52171326,-0.4592305,1.8570362,-0.6186755,0.94023055,-0.57338566,0.5270257,-0.6179389,2.302543,1.1004333,0.15528035,-0.6682474,1.890626,-0.59257406,1.331521,-0.6001429,1.5220151,0.93749076,-0.59497476,-0.66552746,-0.6482407,-0.4732165,0.... 3 217.249588 5 332.983734
1 /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/01_FLAT/art/sb67p021.jpg art/sb67p021.jpg art xtra 4 0.170976,0.008673,0.008480,0.017028,0.794843 1.1073987,0.3512016,-0.73929733,-0.6553513,1.7477593,-0.65341413,0.32179314,-0.4896673,-0.1797334,-0.42715576,1.3163843,-0.72562873,-0.61387855,-0.6266761,-0.35361218,0.37611246,-0.08771938,-0.5262803,0.9261699,-0.6497359,-0.64108604,-0.55193967,-0.5446661,-0.6779002,-0.32559583,-0.6690378,-0.4518578,0.51828945,-0.4238917,-0.45211998,-0.16527033,-0.67007643,1.0136865,-0.4592305,-0.600525,-0.060860336,-0.19446748,-0.24127388,2.2282472,1.8003348,-0.61049384,0.39795423,0.2626753,-0.6682474,-0.75794554,-0.59257406,0.80257696,-0.6001429,-0.651804,-0.028328001,0.53641737,-0.6501347,-0.6482407,0.... 3 132.26111 0 ... 0_drawings 0 True /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/10_SIMPLE_CROP/0_drawings/sb67p021.jpg /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/03_VISUAL_HAND_LABELED/0_drawings/sb67p021.jpg -0.20756221,-0.24843562,0.29454154,-0.6553513,-0.6254566,-0.65341413,-0.7267234,-0.4896673,-0.7537334,-0.42715576,0.9697293,-0.72562873,-0.662768,-0.6266761,-0.23836556,0.4814458,-0.5467274,-0.6520286,0.838902,-0.6497359,-0.57338166,-0.55193967,-0.5446661,-0.28419846,1.6012006,-0.6690378,-0.4518578,-0.0104218125,-0.73986673,-0.3002332,-0.68509877,-0.67007643,-0.36297536,-0.4592305,-0.600525,-0.6186755,-0.73933,-0.57338566,-0.65925777,1.6904012,-0.61049384,-0.58021957,0.508085,0.14767355,0.8082305,-0.59257406,-0.6157326,-0.6001429,-0.651804,-0.30467254,0.17396247,-0.66552746,-0.6482407,-0.0... 2 169.947693 5 126.699768
2 /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/01_FLAT/art/sb25p227.jpg art/sb25p227.jpg art xtra 4 0.158396,0.008277,0.007424,0.016584,0.809319 1.3776337,-0.5714155,-0.2587232,-0.6553513,1.3532461,-0.65341413,-0.7267234,-0.4896673,-0.7537334,-0.25077122,0.050992966,-0.72562873,0.1406585,-0.6266761,1.0653365,0.96198404,-0.5467274,0.30261123,0.6327609,-0.6497359,-0.64108604,-0.28434965,-0.35651857,-0.6779002,-0.28245115,-0.6690378,-0.4518578,0.030088186,-0.73986673,-0.18931103,-0.041653574,-0.67007643,-0.52171326,-0.29881266,-0.600525,-0.23231092,-0.73933,-0.57338566,-0.65925777,1.8833572,-0.61049384,0.44560486,0.14075392,-0.6682474,-0.75794554,-0.59257406,-0.07511848,-0.6001429,-0.651804,-0.5315948,0.023931146,0.723624,-0.6482407,-... 8 188.58075 0 ... 0_drawings 0 True /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/10_SIMPLE_CROP/0_drawings/sb25p227.jpg /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/03_VISUAL_HAND_LABELED/0_drawings/sb25p227.jpg -0.6198182,-0.428226,-0.73929733,-0.6553513,-0.49369657,-0.65341413,-0.7267234,-0.4896673,-0.7537334,-0.28293163,-0.62038505,-0.32824886,2.5504894,-0.6266761,0.8397537,0.85716057,-0.5467274,-0.058725297,0.64954805,-0.6497359,-0.64108604,-0.36876833,-0.5446661,-0.29563427,0.08626467,-0.6690378,-0.4518578,0.64337015,-0.73986673,0.018805295,-0.68509877,-0.67007643,1.5876667,-0.4592305,-0.600525,-0.6186755,0.28688914,-0.57338566,-0.65925777,1.6810645,-0.61049384,1.8564332,-0.6189488,-0.6682474,-0.75794554,-0.59257406,-0.6157326,-0.6001429,-0.63579994,-0.45296612,-0.29925343,-0.0263654,-0.64824... 3 162.882431 5 257.762512
3 /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/01_FLAT/art/sb48p057.jpg art/sb48p057.jpg art xtra 4 0.165322,0.008453,0.008010,0.016587,0.801628 2.4936543,0.17563903,-0.6522293,-0.55642915,1.1084181,-0.5028205,-0.046447277,-0.4896673,-0.7537334,-0.42715576,0.84124434,-0.72562873,-0.52445275,-0.5557985,-0.21369287,2.2372599,-0.26381853,-0.6520286,-0.6898426,-0.6497359,-0.64108604,0.43080842,-0.23286673,-0.6779002,0.7969176,-0.6690378,-0.4518578,0.747658,0.04896885,-0.45211998,-0.68509877,-0.2462106,0.7319356,-0.4592305,-0.600525,-0.6186755,-0.5338096,-0.57338566,1.1886733,0.04046011,-0.61049384,0.45326668,0.72983754,-0.6682474,-0.10000485,0.034278154,-0.33160114,-0.6001429,-0.651804,-0.5315948,-0.20898154,-0.66552746,1.2346795,-0.47... 14 90.26291 0 ... 0_drawings 0 True /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/10_SIMPLE_CROP/0_drawings/sb48p057.jpg /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/03_VISUAL_HAND_LABELED/0_drawings/sb48p057.jpg -0.34353483,-0.5714155,2.2665114,-0.6553513,-0.42076486,-0.6254998,-0.7267234,-0.4896673,-0.7537334,-0.42715576,0.6137707,-0.72562873,0.2611376,1.0485492,0.91806084,-0.452704,-0.5467274,-0.6520286,0.621349,-0.6497359,-0.64108604,-0.55193967,-0.5446661,-0.6779002,0.7967064,0.011958599,-0.4518578,-0.25104153,-0.6493137,-0.45211998,-0.02894944,-0.67007643,1.3037661,-0.4592305,-0.600525,-0.6186755,-0.072172046,-0.57338566,0.42140257,0.8994249,-0.61049384,-0.35844505,-0.03452295,-0.40064916,0.1334514,-0.59257406,-0.06328797,-0.6001429,-0.651804,-0.5315948,0.55393887,-0.66552746,-0.6482407,0.165... 4 94.257965 2 145.937225
4 /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/01_FLAT/art/sb77p044.jpg art/sb77p044.jpg art xtra 4 0.171638,0.008182,0.008061,0.016469,0.795650 2.170152,-0.01916939,-0.47766963,-0.6553513,-0.44795185,-0.65341413,1.5596724,-0.4896673,-0.7537334,-0.42715576,1.0671424,-0.72562873,1.8207353,-0.6266761,-0.6194963,1.1724913,-0.5467274,0.12343103,1.5514618,-0.6497359,0.23890108,-0.55193967,-0.5446661,-0.6779002,-0.57759243,0.33040416,-0.4518578,0.39869583,0.120936334,-0.45211998,-0.68509877,0.2514736,0.17836922,-0.4592305,-0.600525,-0.6186755,-0.73933,-0.57338566,1.3668395,0.6006557,1.2428443,1.0844817,0.36636358,0.48543411,-0.5954572,-0.59257406,-0.30289415,1.2783914,0.5800507,-0.23473695,-0.59497476,-0.66552746,2.2758756,-0.4732165,-0.... 4 176.29102 0 ... 0_drawings 0 True /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/10_SIMPLE_CROP/0_drawings/sb77p044.jpg /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/03_VISUAL_HAND_LABELED/0_drawings/sb77p044.jpg -0.3477007,-0.5714155,-0.73929733,-0.6553513,-0.6254566,-0.65341413,-0.7267234,-0.4896673,-0.7537334,-0.14662892,-0.43905735,-0.64813715,0.059202433,-0.6266761,-0.51404697,-0.20505324,-0.5467274,-0.6520286,1.2549256,-0.6497359,-0.64108604,-0.55193967,-0.5446661,-0.6779002,-0.41643643,-0.6690378,-0.22824319,-0.5982413,-0.73986673,-0.3338361,-0.68509877,0.10866904,-0.1451351,-0.4592305,0.5446466,0.7924262,-0.73933,-0.57338566,-0.45801556,-0.11409092,-0.4252534,0.4120332,-0.6189488,-0.28175777,2.210379,-0.59257406,-0.070759535,-0.6001429,-0.651804,0.012511611,0.26820052,-0.66552746,0.9221995,... 0 173.559937 5 197.142792

5 rows × 25 columns

show_all_clusters(
    clusters_df=drawings_df, clusters=drawings_cropped_I, title="drawings_cropped_emb"
)

fig = plt.scatter(
    x=drawings_cropped_X_tsne[:, 0],
    y=drawings_cropped_X_tsne[:, 1],
    c=drawings_df.drawings_cropped_cluster_id,
    s=2.0,
)

watercolors_emb

watercolors_df = watercolors_df.reindex()
ncentroids = 8
niter = 20
verbose = False
watercolors_kmeans = faiss.Kmeans(
    watercolors_emb.shape[1], ncentroids, niter=niter, verbose=verbose, gpu=True
)
watercolors_kmeans.train(watercolors_emb)
watercolors_D, watercolors_I = watercolors_index.search(
    watercolors_kmeans.centroids, 16
)

watercolors_kD, watercolors_kI = watercolors_kmeans.index.search(watercolors_emb, 1)
watercolors_df.loc[:, "watercolors_cluster_id"] = watercolors_kI
watercolors_df.loc[:, "watercolors_cluster_dist"] = watercolors_kD
watercolors_df.head()
abs_fname rel_fname label pred_label pred_idx pred_probs emb_csv cluster cluster_dist metacluster ... visual_abs_path handlabeled_rel_path handlabeled_metacluster_name handlabeled_metacluster_id handlabeled_metacluster_was_correct preprocessed_abs_path handlabeled_abs_path emb_csv_cropped watercolors_cluster_id watercolors_cluster_dist
0 /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/01_FLAT/art/sb07p104.jpg art/sb07p104.jpg art xtra 4 0.177406,0.008799,0.008245,0.017177,0.788373 -0.39105213,0.96309596,-0.73929733,0.4489988,0.8297614,-0.3937308,-0.7267234,-0.32461396,-0.7537334,-0.42715576,-0.62038505,-0.72562873,0.3037846,-0.6266761,-0.5213815,-0.31669965,-0.5467274,-0.6520286,-0.22544897,-0.6497359,-0.64108604,0.6374447,-0.5446661,-0.6779002,-0.14143991,-0.6690378,-0.44753593,0.66945183,-0.73986673,-0.45211998,-0.05996394,-0.21525535,0.82928157,-0.04412651,-0.600525,-0.04148197,-0.73825717,-0.57338566,-0.25227422,2.3566113,-0.61049384,1.0027854,-0.40134108,1.3733256,-0.75794554,-0.59257406,-0.4395525,-0.6001429,1.0358506,1.1911299,0.8162154,0.032713354,-0.6482407... 5 238.33170 1 ... /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/02_VISUAL_CATEGORIES/1_watercolors/sb07p104.jpg 1_watercolors/sb07p104.jpg 1_watercolors 1 True /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/10_SIMPLE_CROP/1_watercolors/sb07p104.jpg /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/03_VISUAL_HAND_LABELED/1_watercolors/sb07p104.jpg -0.6198182,0.8895926,-0.73929733,0.6418346,0.46164584,1.0085131,-0.7267234,-0.4896673,-0.7537334,-0.42715576,-0.62038505,-0.72562873,1.4399182,-0.6266761,0.474914,-0.57515705,-0.5467274,-0.6520286,1.2274435,-0.6497359,-0.27622125,-0.45870692,-0.5446661,-0.6779002,1.3343718,-0.6690378,-0.4518578,0.42277813,-0.73986673,-0.45211998,1.6291834,-0.67007643,-0.09817025,-0.00090405345,-0.600525,-0.6186755,-0.73933,-0.57338566,0.006386578,1.034553,-0.61049384,-0.58021957,-0.09483403,0.78779536,-0.73080033,0.10947651,0.3367887,-0.5382227,-0.26548737,0.5630663,2.15088,0.2266624,-0.6482407,0.049348265... 7 215.029266
1 /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/01_FLAT/art/sb31p017.jpg art/sb31p017.jpg art xtra 4 0.172119,0.008924,0.008226,0.016950,0.793781 -0.05104202,-0.3935787,-0.73929733,0.86878717,-0.6254566,-0.65341413,-0.7267234,-0.4896673,-0.7537334,-0.14799604,-0.62038505,-0.72562873,-0.2654881,-0.6266761,-0.68991846,-0.57515705,-0.41532665,-0.6520286,-0.6898426,-0.34099144,-0.64108604,-0.55193967,-0.5446661,-0.6779002,-0.2674706,-0.53598946,-0.13334358,-0.5982413,-0.73986673,-0.45211998,-0.68509877,0.033780396,-0.52171326,0.054827005,-0.20721096,0.3301326,-0.73933,-0.57338566,0.34032136,-0.6179389,-0.20170414,0.16225064,-0.44437563,0.44581896,-0.069196045,0.20976627,-0.07846111,-0.6001429,0.38122594,-0.09738222,-0.59497476,-0.665527... 11 191.66959 1 ... /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/02_VISUAL_CATEGORIES/1_watercolors/sb31p017.jpg 1_watercolors/sb31p017.jpg 1_watercolors 1 True /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/10_SIMPLE_CROP/1_watercolors/sb31p017.jpg /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/03_VISUAL_HAND_LABELED/1_watercolors/sb31p017.jpg 1.491735,-0.5714155,-0.73929733,0.05867392,0.5154146,0.0936929,-0.7267234,-0.4896673,0.4246894,-0.42715576,-0.33477074,-0.72562873,1.2274611,-0.6266761,-0.68991846,-0.57515705,-0.5467274,1.1312869,-0.06054777,-0.028933167,-0.64108604,-0.55193967,-0.5446661,-0.6779002,-0.57759243,0.46393585,0.4817328,0.22738433,-0.73986673,-0.45211998,0.0057709217,-0.67007643,-0.52171326,0.68283725,0.060967267,0.7253895,-0.73933,-0.57338566,-0.65925777,-0.6179389,-0.32987997,0.86336035,-0.6189488,1.3613329,1.2250904,-0.59257406,-0.5857397,-0.6001429,-0.5687719,-0.14814761,0.5325973,-0.66552746,-0.6482407,0.... 4 199.030975
2 /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/01_FLAT/art/sb05p079.jpg art/sb05p079.jpg art xtra 4 0.172158,0.008873,0.008536,0.017017,0.793416 1.8089037,-0.5714155,-0.73929733,-0.10773122,-0.22753507,0.34884918,0.124596715,-0.4896673,-0.27447522,-0.42715576,0.61659455,-0.03226477,-0.662768,-0.6266761,-0.68991846,-0.57515705,-0.39897114,-0.6520286,-0.6898426,-0.6497359,0.16184372,-0.55193967,-0.5446661,-0.6779002,0.04647112,-0.6690378,-0.4518578,0.9576235,0.29423904,-0.45211998,-0.68509877,0.09260088,-0.3948297,-0.4592305,-0.600525,-0.6186755,-0.64046603,-0.57338566,0.08902073,0.09568572,-0.61049384,0.7515181,-0.15892029,-0.4098586,1.8483992,-0.59257406,-0.6157326,-0.56642026,-0.651804,-0.44185895,-0.19970179,0.19587982,1.3608505,... 11 140.32997 1 ... /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/02_VISUAL_CATEGORIES/1_watercolors/sb05p079.jpg 1_watercolors/sb05p079.jpg 1_watercolors 1 NaN /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/10_SIMPLE_CROP/1_watercolors/sb05p079.jpg /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/03_VISUAL_HAND_LABELED/1_watercolors/sb05p079.jpg -0.6013173,-0.5714155,-0.7368871,-0.6553513,-0.6254566,-0.65341413,0.071327925,-0.4896673,-0.7537334,-0.29406685,1.2854458,-0.72562873,1.4279991,-0.2084853,0.4439276,-0.57515705,-0.5467274,-0.2426523,0.6567551,-0.6497359,0.284827,-0.55193967,-0.5446661,-0.6779002,-0.57759243,-0.6690378,0.39760548,-0.5982413,-0.16403872,0.82081807,-0.68509877,-0.67007643,-0.16007048,-0.23898152,0.4340614,-0.6186755,-0.73933,-0.57338566,-0.65925777,-0.60700464,-0.22504222,1.2887287,0.17025876,-0.5827259,3.245521,-0.59257406,1.607188,-0.6001429,-0.1800242,-0.5315948,0.2059763,0.33526373,0.109642506,-0.0013180... 4 142.766022
3 /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/01_FLAT/art/sb26p082.jpg art/sb26p082.jpg art xtra 4 0.179525,0.008828,0.008282,0.017196,0.786169 1.8392665,0.3796271,-0.73929733,0.82189727,1.6830277,0.9302285,-0.5532687,-0.4896673,-0.30764756,-0.42715576,-0.44450876,-0.72562873,-0.662768,0.54702616,-0.68991846,-0.57515705,-0.31611928,-0.59368926,1.2819774,-0.6497359,-0.64108604,-0.55193967,0.84984857,-0.6779002,-0.06536412,-0.6690378,0.34403068,-0.16627067,0.3990196,-0.45211998,0.65170527,-0.67007643,0.6049255,-0.4367706,-0.600525,-0.0046679974,-0.73933,-0.109048486,-0.65925777,0.65358853,-0.61049384,0.70374626,-0.6189488,-0.6682474,-0.0177418,-0.59257406,1.1068444,-0.29651338,-0.651804,-0.5315948,1.8200746,-0.66552746,0.11623299,-0... 7 176.11029 1 ... /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/02_VISUAL_CATEGORIES/1_watercolors/sb26p082.jpg 1_watercolors/sb26p082.jpg 1_watercolors 1 NaN /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/10_SIMPLE_CROP/1_watercolors/sb26p082.jpg /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/03_VISUAL_HAND_LABELED/1_watercolors/sb26p082.jpg 0.8175719,0.48385304,-0.73929733,1.0291914,1.4682066,1.225123,-0.43518582,-0.4896673,-0.7537334,-0.42715576,0.72162604,-0.72562873,-0.662768,-0.6266761,-0.55470747,-0.57515705,-0.5467274,-0.6520286,2.099903,-0.6497359,-0.64108604,-0.55193967,1.3572993,-0.6779002,1.3149762,0.8512635,0.81857395,-0.5982413,0.056738913,-0.45211998,2.0946088,-0.67007643,-0.52171326,-0.4592305,-0.600525,1.1100725,-0.73933,-0.57338566,-0.24140868,0.9004108,-0.61049384,0.4742828,-0.6189488,-0.6682474,0.335356,0.40166396,0.7790335,-0.6001429,-0.651804,-0.4778452,0.7360641,-0.66552746,-0.6482407,-0.13845,-0.7311095,... 1 157.938324
4 /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/01_FLAT/art/sb69p101-color.jpg art/sb69p101-color.jpg art xtra 4 0.179525,0.008828,0.008282,0.017196,0.786169 -0.23259398,-0.5714155,-0.73929733,-0.6553513,0.34417403,1.046661,-0.42288247,-0.4896673,0.39017296,-0.42715576,-0.62038505,-0.72562873,-0.662768,-0.6266761,0.93892807,-0.57515705,-0.5222921,-0.6520286,-0.6898426,-0.6497359,-0.6366938,-0.55193967,-0.5446661,-0.6779002,-0.46687827,-0.6690378,-0.4518578,-0.5982413,0.7252437,-0.45211998,1.8137504,-0.67007643,-0.52171326,-0.36457688,-0.600525,0.8178272,-0.73933,0.23574609,-0.65925777,-0.6179389,-0.61049384,-0.15158218,-0.41958112,-0.6682474,-0.75794554,0.4943592,0.8210626,-0.6001429,-0.651804,-0.080083996,0.48374963,-0.42743486,-0.6482407,-0.4... 7 187.45346 1 ... /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/02_VISUAL_CATEGORIES/1_watercolors/sb69p101-color.jpg 1_watercolors/sb69p101-color.jpg 1_watercolors 1 NaN /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/10_SIMPLE_CROP/1_watercolors/sb69p101-color.jpg /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/03_VISUAL_HAND_LABELED/1_watercolors/sb69p101-color.jpg 0.14908737,-0.5714155,-0.73929733,0.44245207,-0.6254566,1.4611686,-0.7267234,-0.4896673,0.87923527,-0.42715576,-0.62038505,-0.72562873,-0.662768,-0.6266761,0.4918049,-0.57515705,-0.5467274,-0.6520286,-0.6898426,-0.2860955,-0.64108604,-0.55193967,-0.5446661,-0.6779002,0.69009775,-0.6690378,-0.4518578,0.18292433,-0.004632473,-0.45211998,1.7543458,-0.67007643,-0.52171326,-0.41669255,-0.600525,1.4654884,0.5742926,-0.57338566,-0.65925777,-0.6179389,-0.52983093,0.26484245,-0.25630984,-0.6682474,0.19898295,0.95297796,0.38033813,-0.6001429,-0.651804,-0.5315948,1.3264011,0.31547034,-0.6482407,-0.47... 1 167.278229

5 rows × 23 columns

show_all_clusters(
    clusters_df=watercolors_df, clusters=watercolors_I, title="watercolors_emb"
)

fig = plt.scatter(
    x=watercolors_X_tsne[:, 0],
    y=watercolors_X_tsne[:, 1],
    c=watercolors_df.watercolors_cluster_id,
    s=8.0,
)

watercolors_emb_cropped

ncentroids = 8
niter = 20
verbose = False
watercolors_cropped_kmeans = faiss.Kmeans(
    watercolors_cropped_emb.shape[1], ncentroids, niter=niter, verbose=verbose, gpu=True
)
watercolors_cropped_kmeans.train(watercolors_cropped_emb)
watercolors_cropped_D, watercolors_cropped_I = watercolors_cropped_index.search(
    watercolors_cropped_kmeans.centroids, 16
)

(
    watercolors_cropped_kD,
    watercolors_cropped_kI,
) = watercolors_cropped_kmeans.index.search(watercolors_cropped_emb, 1)
watercolors_df.loc[:, "watercolors_cropped_cluster_id"] = watercolors_cropped_kI
watercolors_df.loc[:, "watercolors_cropped_cluster_dist"] = watercolors_cropped_kD
watercolors_df.head()
abs_fname rel_fname label pred_label pred_idx pred_probs emb_csv cluster cluster_dist metacluster ... handlabeled_metacluster_name handlabeled_metacluster_id handlabeled_metacluster_was_correct preprocessed_abs_path handlabeled_abs_path emb_csv_cropped watercolors_cluster_id watercolors_cluster_dist watercolors_cropped_cluster_id watercolors_cropped_cluster_dist
0 /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/01_FLAT/art/sb07p104.jpg art/sb07p104.jpg art xtra 4 0.177406,0.008799,0.008245,0.017177,0.788373 -0.39105213,0.96309596,-0.73929733,0.4489988,0.8297614,-0.3937308,-0.7267234,-0.32461396,-0.7537334,-0.42715576,-0.62038505,-0.72562873,0.3037846,-0.6266761,-0.5213815,-0.31669965,-0.5467274,-0.6520286,-0.22544897,-0.6497359,-0.64108604,0.6374447,-0.5446661,-0.6779002,-0.14143991,-0.6690378,-0.44753593,0.66945183,-0.73986673,-0.45211998,-0.05996394,-0.21525535,0.82928157,-0.04412651,-0.600525,-0.04148197,-0.73825717,-0.57338566,-0.25227422,2.3566113,-0.61049384,1.0027854,-0.40134108,1.3733256,-0.75794554,-0.59257406,-0.4395525,-0.6001429,1.0358506,1.1911299,0.8162154,0.032713354,-0.6482407... 5 238.33170 1 ... 1_watercolors 1 True /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/10_SIMPLE_CROP/1_watercolors/sb07p104.jpg /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/03_VISUAL_HAND_LABELED/1_watercolors/sb07p104.jpg -0.6198182,0.8895926,-0.73929733,0.6418346,0.46164584,1.0085131,-0.7267234,-0.4896673,-0.7537334,-0.42715576,-0.62038505,-0.72562873,1.4399182,-0.6266761,0.474914,-0.57515705,-0.5467274,-0.6520286,1.2274435,-0.6497359,-0.27622125,-0.45870692,-0.5446661,-0.6779002,1.3343718,-0.6690378,-0.4518578,0.42277813,-0.73986673,-0.45211998,1.6291834,-0.67007643,-0.09817025,-0.00090405345,-0.600525,-0.6186755,-0.73933,-0.57338566,0.006386578,1.034553,-0.61049384,-0.58021957,-0.09483403,0.78779536,-0.73080033,0.10947651,0.3367887,-0.5382227,-0.26548737,0.5630663,2.15088,0.2266624,-0.6482407,0.049348265... 7 215.029266 7 206.641174
1 /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/01_FLAT/art/sb31p017.jpg art/sb31p017.jpg art xtra 4 0.172119,0.008924,0.008226,0.016950,0.793781 -0.05104202,-0.3935787,-0.73929733,0.86878717,-0.6254566,-0.65341413,-0.7267234,-0.4896673,-0.7537334,-0.14799604,-0.62038505,-0.72562873,-0.2654881,-0.6266761,-0.68991846,-0.57515705,-0.41532665,-0.6520286,-0.6898426,-0.34099144,-0.64108604,-0.55193967,-0.5446661,-0.6779002,-0.2674706,-0.53598946,-0.13334358,-0.5982413,-0.73986673,-0.45211998,-0.68509877,0.033780396,-0.52171326,0.054827005,-0.20721096,0.3301326,-0.73933,-0.57338566,0.34032136,-0.6179389,-0.20170414,0.16225064,-0.44437563,0.44581896,-0.069196045,0.20976627,-0.07846111,-0.6001429,0.38122594,-0.09738222,-0.59497476,-0.665527... 11 191.66959 1 ... 1_watercolors 1 True /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/10_SIMPLE_CROP/1_watercolors/sb31p017.jpg /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/03_VISUAL_HAND_LABELED/1_watercolors/sb31p017.jpg 1.491735,-0.5714155,-0.73929733,0.05867392,0.5154146,0.0936929,-0.7267234,-0.4896673,0.4246894,-0.42715576,-0.33477074,-0.72562873,1.2274611,-0.6266761,-0.68991846,-0.57515705,-0.5467274,1.1312869,-0.06054777,-0.028933167,-0.64108604,-0.55193967,-0.5446661,-0.6779002,-0.57759243,0.46393585,0.4817328,0.22738433,-0.73986673,-0.45211998,0.0057709217,-0.67007643,-0.52171326,0.68283725,0.060967267,0.7253895,-0.73933,-0.57338566,-0.65925777,-0.6179389,-0.32987997,0.86336035,-0.6189488,1.3613329,1.2250904,-0.59257406,-0.5857397,-0.6001429,-0.5687719,-0.14814761,0.5325973,-0.66552746,-0.6482407,0.... 4 199.030975 4 195.975464
2 /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/01_FLAT/art/sb05p079.jpg art/sb05p079.jpg art xtra 4 0.172158,0.008873,0.008536,0.017017,0.793416 1.8089037,-0.5714155,-0.73929733,-0.10773122,-0.22753507,0.34884918,0.124596715,-0.4896673,-0.27447522,-0.42715576,0.61659455,-0.03226477,-0.662768,-0.6266761,-0.68991846,-0.57515705,-0.39897114,-0.6520286,-0.6898426,-0.6497359,0.16184372,-0.55193967,-0.5446661,-0.6779002,0.04647112,-0.6690378,-0.4518578,0.9576235,0.29423904,-0.45211998,-0.68509877,0.09260088,-0.3948297,-0.4592305,-0.600525,-0.6186755,-0.64046603,-0.57338566,0.08902073,0.09568572,-0.61049384,0.7515181,-0.15892029,-0.4098586,1.8483992,-0.59257406,-0.6157326,-0.56642026,-0.651804,-0.44185895,-0.19970179,0.19587982,1.3608505,... 11 140.32997 1 ... 1_watercolors 1 NaN /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/10_SIMPLE_CROP/1_watercolors/sb05p079.jpg /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/03_VISUAL_HAND_LABELED/1_watercolors/sb05p079.jpg -0.6013173,-0.5714155,-0.7368871,-0.6553513,-0.6254566,-0.65341413,0.071327925,-0.4896673,-0.7537334,-0.29406685,1.2854458,-0.72562873,1.4279991,-0.2084853,0.4439276,-0.57515705,-0.5467274,-0.2426523,0.6567551,-0.6497359,0.284827,-0.55193967,-0.5446661,-0.6779002,-0.57759243,-0.6690378,0.39760548,-0.5982413,-0.16403872,0.82081807,-0.68509877,-0.67007643,-0.16007048,-0.23898152,0.4340614,-0.6186755,-0.73933,-0.57338566,-0.65925777,-0.60700464,-0.22504222,1.2887287,0.17025876,-0.5827259,3.245521,-0.59257406,1.607188,-0.6001429,-0.1800242,-0.5315948,0.2059763,0.33526373,0.109642506,-0.0013180... 4 142.766022 4 248.372314
3 /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/01_FLAT/art/sb26p082.jpg art/sb26p082.jpg art xtra 4 0.179525,0.008828,0.008282,0.017196,0.786169 1.8392665,0.3796271,-0.73929733,0.82189727,1.6830277,0.9302285,-0.5532687,-0.4896673,-0.30764756,-0.42715576,-0.44450876,-0.72562873,-0.662768,0.54702616,-0.68991846,-0.57515705,-0.31611928,-0.59368926,1.2819774,-0.6497359,-0.64108604,-0.55193967,0.84984857,-0.6779002,-0.06536412,-0.6690378,0.34403068,-0.16627067,0.3990196,-0.45211998,0.65170527,-0.67007643,0.6049255,-0.4367706,-0.600525,-0.0046679974,-0.73933,-0.109048486,-0.65925777,0.65358853,-0.61049384,0.70374626,-0.6189488,-0.6682474,-0.0177418,-0.59257406,1.1068444,-0.29651338,-0.651804,-0.5315948,1.8200746,-0.66552746,0.11623299,-0... 7 176.11029 1 ... 1_watercolors 1 NaN /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/10_SIMPLE_CROP/1_watercolors/sb26p082.jpg /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/03_VISUAL_HAND_LABELED/1_watercolors/sb26p082.jpg 0.8175719,0.48385304,-0.73929733,1.0291914,1.4682066,1.225123,-0.43518582,-0.4896673,-0.7537334,-0.42715576,0.72162604,-0.72562873,-0.662768,-0.6266761,-0.55470747,-0.57515705,-0.5467274,-0.6520286,2.099903,-0.6497359,-0.64108604,-0.55193967,1.3572993,-0.6779002,1.3149762,0.8512635,0.81857395,-0.5982413,0.056738913,-0.45211998,2.0946088,-0.67007643,-0.52171326,-0.4592305,-0.600525,1.1100725,-0.73933,-0.57338566,-0.24140868,0.9004108,-0.61049384,0.4742828,-0.6189488,-0.6682474,0.335356,0.40166396,0.7790335,-0.6001429,-0.651804,-0.4778452,0.7360641,-0.66552746,-0.6482407,-0.13845,-0.7311095,... 1 157.938324 1 196.849426
4 /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/01_FLAT/art/sb69p101-color.jpg art/sb69p101-color.jpg art xtra 4 0.179525,0.008828,0.008282,0.017196,0.786169 -0.23259398,-0.5714155,-0.73929733,-0.6553513,0.34417403,1.046661,-0.42288247,-0.4896673,0.39017296,-0.42715576,-0.62038505,-0.72562873,-0.662768,-0.6266761,0.93892807,-0.57515705,-0.5222921,-0.6520286,-0.6898426,-0.6497359,-0.6366938,-0.55193967,-0.5446661,-0.6779002,-0.46687827,-0.6690378,-0.4518578,-0.5982413,0.7252437,-0.45211998,1.8137504,-0.67007643,-0.52171326,-0.36457688,-0.600525,0.8178272,-0.73933,0.23574609,-0.65925777,-0.6179389,-0.61049384,-0.15158218,-0.41958112,-0.6682474,-0.75794554,0.4943592,0.8210626,-0.6001429,-0.651804,-0.080083996,0.48374963,-0.42743486,-0.6482407,-0.4... 7 187.45346 1 ... 1_watercolors 1 NaN /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/10_SIMPLE_CROP/1_watercolors/sb69p101-color.jpg /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/03_VISUAL_HAND_LABELED/1_watercolors/sb69p101-color.jpg 0.14908737,-0.5714155,-0.73929733,0.44245207,-0.6254566,1.4611686,-0.7267234,-0.4896673,0.87923527,-0.42715576,-0.62038505,-0.72562873,-0.662768,-0.6266761,0.4918049,-0.57515705,-0.5467274,-0.6520286,-0.6898426,-0.2860955,-0.64108604,-0.55193967,-0.5446661,-0.6779002,0.69009775,-0.6690378,-0.4518578,0.18292433,-0.004632473,-0.45211998,1.7543458,-0.67007643,-0.52171326,-0.41669255,-0.600525,1.4654884,0.5742926,-0.57338566,-0.65925777,-0.6179389,-0.52983093,0.26484245,-0.25630984,-0.6682474,0.19898295,0.95297796,0.38033813,-0.6001429,-0.651804,-0.5315948,1.3264011,0.31547034,-0.6482407,-0.47... 1 167.278229 1 136.638000

5 rows × 25 columns

show_all_clusters(
    clusters_df=watercolors_df,
    clusters=watercolors_cropped_I,
    title="watercolors_cropped_emb",
)

fig = plt.scatter(
    x=watercolors_cropped_X_tsne[:, 0],
    y=watercolors_cropped_X_tsne[:, 1],
    c=watercolors_df.watercolors_cropped_cluster_id,
    s=8.0,
)

side quest: varying the numbers of centroids for drawings

drawings_cluster16

ncentroids = 16
niter = 20
verbose = False
drawings_cluster16_kmeans = faiss.Kmeans(
    drawings_emb.shape[1], ncentroids, niter=niter, verbose=verbose, gpu=True
)
drawings_cluster16_kmeans.train(drawings_emb)
drawings_cluster16_D, drawings_cluster16_I = drawings_index.search(
    drawings_cluster16_kmeans.centroids, 16
)

drawings_cluster16_kD, drawings_cluster16_kI = drawings_cluster16_kmeans.index.search(
    drawings_emb, 1
)
drawings_df.loc[:, "drawings_cluster16_id"] = drawings_cluster16_kI
drawings_df.loc[:, "drawings_cluster16_dist"] = drawings_cluster16_kD
drawings_df.head()
abs_fname rel_fname label pred_label pred_idx pred_probs emb_csv cluster cluster_dist metacluster ... handlabeled_abs_path emb_csv_cropped drawings_cluster_id drawings_cluster_dist drawings_cropped_cluster_id drawings_cropped_cluster_dist drawings_cluster32_id drawings_cluster32_dist drawings_cluster16_id drawings_cluster16_dist
0 /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/01_FLAT/art/sb77p043.jpg art/sb77p043.jpg art xtra 4 0.168532,0.008473,0.008068,0.016940,0.797986 -0.6198182,-0.5714155,-0.6871516,-0.6553513,-0.6254566,-0.65341413,-0.7267234,-0.4896673,-0.7537334,-0.42715576,1.4904574,-0.72562873,-0.662768,-0.6266761,0.6913696,0.054546177,-0.5467274,-0.6520286,0.117179275,0.94330966,0.5815062,-0.55193967,-0.5446661,-0.6779002,-0.57759243,-0.4584825,-0.3818994,-0.5750927,-0.73986673,-0.45211998,-0.6141643,-0.67007643,-0.52171326,-0.4592305,1.4788612,-0.6186755,0.799198,-0.57338566,-0.17778617,0.10336053,0.093812525,0.17924881,-0.6189488,-0.6682474,2.1040225,-0.59257406,1.6553459,-0.6001429,0.5109105,0.19352531,-0.2517513,-0.66552746,-0.6482407,-0.4732... 11 199.22961 1 ... /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/03_VISUAL_HAND_LABELED/0_drawings/sb77p043.jpg -0.6198182,-0.5714155,0.2937309,0.2691822,-0.6254566,-0.46855158,-0.7267234,-0.4896673,-0.7537334,-0.42715576,2.241211,-0.013144195,-0.30681813,-0.6266761,0.43516117,-0.57515705,-0.5467274,-0.5245168,1.3334948,2.1400952,-0.64108604,-0.55193967,-0.5446661,-0.6779002,-0.57759243,-0.6690378,0.38178188,-0.5982413,-0.50063276,-0.21540937,0.4948988,-0.67007643,-0.52171326,-0.4592305,1.8570362,-0.6186755,0.94023055,-0.57338566,0.5270257,-0.6179389,2.302543,1.1004333,0.15528035,-0.6682474,1.890626,-0.59257406,1.331521,-0.6001429,1.5220151,0.93749076,-0.59497476,-0.66552746,-0.6482407,-0.4732165,0.... 3 217.249588 5 332.983734 15 166.716202 3 169.585052
1 /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/01_FLAT/art/sb67p021.jpg art/sb67p021.jpg art xtra 4 0.170976,0.008673,0.008480,0.017028,0.794843 1.1073987,0.3512016,-0.73929733,-0.6553513,1.7477593,-0.65341413,0.32179314,-0.4896673,-0.1797334,-0.42715576,1.3163843,-0.72562873,-0.61387855,-0.6266761,-0.35361218,0.37611246,-0.08771938,-0.5262803,0.9261699,-0.6497359,-0.64108604,-0.55193967,-0.5446661,-0.6779002,-0.32559583,-0.6690378,-0.4518578,0.51828945,-0.4238917,-0.45211998,-0.16527033,-0.67007643,1.0136865,-0.4592305,-0.600525,-0.060860336,-0.19446748,-0.24127388,2.2282472,1.8003348,-0.61049384,0.39795423,0.2626753,-0.6682474,-0.75794554,-0.59257406,0.80257696,-0.6001429,-0.651804,-0.028328001,0.53641737,-0.6501347,-0.6482407,0.... 3 132.26111 0 ... /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/03_VISUAL_HAND_LABELED/0_drawings/sb67p021.jpg -0.20756221,-0.24843562,0.29454154,-0.6553513,-0.6254566,-0.65341413,-0.7267234,-0.4896673,-0.7537334,-0.42715576,0.9697293,-0.72562873,-0.662768,-0.6266761,-0.23836556,0.4814458,-0.5467274,-0.6520286,0.838902,-0.6497359,-0.57338166,-0.55193967,-0.5446661,-0.28419846,1.6012006,-0.6690378,-0.4518578,-0.0104218125,-0.73986673,-0.3002332,-0.68509877,-0.67007643,-0.36297536,-0.4592305,-0.600525,-0.6186755,-0.73933,-0.57338566,-0.65925777,1.6904012,-0.61049384,-0.58021957,0.508085,0.14767355,0.8082305,-0.59257406,-0.6157326,-0.6001429,-0.651804,-0.30467254,0.17396247,-0.66552746,-0.6482407,-0.0... 2 169.947693 5 126.699768 18 137.920044 8 141.980621
2 /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/01_FLAT/art/sb25p227.jpg art/sb25p227.jpg art xtra 4 0.158396,0.008277,0.007424,0.016584,0.809319 1.3776337,-0.5714155,-0.2587232,-0.6553513,1.3532461,-0.65341413,-0.7267234,-0.4896673,-0.7537334,-0.25077122,0.050992966,-0.72562873,0.1406585,-0.6266761,1.0653365,0.96198404,-0.5467274,0.30261123,0.6327609,-0.6497359,-0.64108604,-0.28434965,-0.35651857,-0.6779002,-0.28245115,-0.6690378,-0.4518578,0.030088186,-0.73986673,-0.18931103,-0.041653574,-0.67007643,-0.52171326,-0.29881266,-0.600525,-0.23231092,-0.73933,-0.57338566,-0.65925777,1.8833572,-0.61049384,0.44560486,0.14075392,-0.6682474,-0.75794554,-0.59257406,-0.07511848,-0.6001429,-0.651804,-0.5315948,0.023931146,0.723624,-0.6482407,-... 8 188.58075 0 ... /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/03_VISUAL_HAND_LABELED/0_drawings/sb25p227.jpg -0.6198182,-0.428226,-0.73929733,-0.6553513,-0.49369657,-0.65341413,-0.7267234,-0.4896673,-0.7537334,-0.28293163,-0.62038505,-0.32824886,2.5504894,-0.6266761,0.8397537,0.85716057,-0.5467274,-0.058725297,0.64954805,-0.6497359,-0.64108604,-0.36876833,-0.5446661,-0.29563427,0.08626467,-0.6690378,-0.4518578,0.64337015,-0.73986673,0.018805295,-0.68509877,-0.67007643,1.5876667,-0.4592305,-0.600525,-0.6186755,0.28688914,-0.57338566,-0.65925777,1.6810645,-0.61049384,1.8564332,-0.6189488,-0.6682474,-0.75794554,-0.59257406,-0.6157326,-0.6001429,-0.63579994,-0.45296612,-0.29925343,-0.0263654,-0.64824... 3 162.882431 5 257.762512 8 154.434723 14 161.993011
3 /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/01_FLAT/art/sb48p057.jpg art/sb48p057.jpg art xtra 4 0.165322,0.008453,0.008010,0.016587,0.801628 2.4936543,0.17563903,-0.6522293,-0.55642915,1.1084181,-0.5028205,-0.046447277,-0.4896673,-0.7537334,-0.42715576,0.84124434,-0.72562873,-0.52445275,-0.5557985,-0.21369287,2.2372599,-0.26381853,-0.6520286,-0.6898426,-0.6497359,-0.64108604,0.43080842,-0.23286673,-0.6779002,0.7969176,-0.6690378,-0.4518578,0.747658,0.04896885,-0.45211998,-0.68509877,-0.2462106,0.7319356,-0.4592305,-0.600525,-0.6186755,-0.5338096,-0.57338566,1.1886733,0.04046011,-0.61049384,0.45326668,0.72983754,-0.6682474,-0.10000485,0.034278154,-0.33160114,-0.6001429,-0.651804,-0.5315948,-0.20898154,-0.66552746,1.2346795,-0.47... 14 90.26291 0 ... /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/03_VISUAL_HAND_LABELED/0_drawings/sb48p057.jpg -0.34353483,-0.5714155,2.2665114,-0.6553513,-0.42076486,-0.6254998,-0.7267234,-0.4896673,-0.7537334,-0.42715576,0.6137707,-0.72562873,0.2611376,1.0485492,0.91806084,-0.452704,-0.5467274,-0.6520286,0.621349,-0.6497359,-0.64108604,-0.55193967,-0.5446661,-0.6779002,0.7967064,0.011958599,-0.4518578,-0.25104153,-0.6493137,-0.45211998,-0.02894944,-0.67007643,1.3037661,-0.4592305,-0.600525,-0.6186755,-0.072172046,-0.57338566,0.42140257,0.8994249,-0.61049384,-0.35844505,-0.03452295,-0.40064916,0.1334514,-0.59257406,-0.06328797,-0.6001429,-0.651804,-0.5315948,0.55393887,-0.66552746,-0.6482407,0.165... 4 94.257965 2 145.937225 28 85.081177 15 92.158417
4 /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/01_FLAT/art/sb77p044.jpg art/sb77p044.jpg art xtra 4 0.171638,0.008182,0.008061,0.016469,0.795650 2.170152,-0.01916939,-0.47766963,-0.6553513,-0.44795185,-0.65341413,1.5596724,-0.4896673,-0.7537334,-0.42715576,1.0671424,-0.72562873,1.8207353,-0.6266761,-0.6194963,1.1724913,-0.5467274,0.12343103,1.5514618,-0.6497359,0.23890108,-0.55193967,-0.5446661,-0.6779002,-0.57759243,0.33040416,-0.4518578,0.39869583,0.120936334,-0.45211998,-0.68509877,0.2514736,0.17836922,-0.4592305,-0.600525,-0.6186755,-0.73933,-0.57338566,1.3668395,0.6006557,1.2428443,1.0844817,0.36636358,0.48543411,-0.5954572,-0.59257406,-0.30289415,1.2783914,0.5800507,-0.23473695,-0.59497476,-0.66552746,2.2758756,-0.4732165,-0.... 4 176.29102 0 ... /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/03_VISUAL_HAND_LABELED/0_drawings/sb77p044.jpg -0.3477007,-0.5714155,-0.73929733,-0.6553513,-0.6254566,-0.65341413,-0.7267234,-0.4896673,-0.7537334,-0.14662892,-0.43905735,-0.64813715,0.059202433,-0.6266761,-0.51404697,-0.20505324,-0.5467274,-0.6520286,1.2549256,-0.6497359,-0.64108604,-0.55193967,-0.5446661,-0.6779002,-0.41643643,-0.6690378,-0.22824319,-0.5982413,-0.73986673,-0.3338361,-0.68509877,0.10866904,-0.1451351,-0.4592305,0.5446466,0.7924262,-0.73933,-0.57338566,-0.45801556,-0.11409092,-0.4252534,0.4120332,-0.6189488,-0.28175777,2.210379,-0.59257406,-0.070759535,-0.6001429,-0.651804,0.012511611,0.26820052,-0.66552746,0.9221995,... 0 173.559937 5 197.142792 25 167.685181 0 166.856781

5 rows × 29 columns

show_all_clusters(
    clusters_df=drawings_df,
    clusters=drawings_cluster16_I,
    title="drawings_cluster16_emb",
)

fig = plt.scatter(
    x=drawings_X_tsne[:, 0],
    y=drawings_X_tsne[:, 1],
    c=drawings_df.drawings_cluster16_id,
    s=2.0,
)

drawings_cluster32

ncentroids = 32
niter = 20
verbose = False
drawings_cluster32_kmeans = faiss.Kmeans(
    drawings_emb.shape[1], ncentroids, niter=niter, verbose=verbose, gpu=True
)
drawings_cluster32_kmeans.train(drawings_emb)
drawings_cluster32_D, drawings_cluster32_I = drawings_index.search(
    drawings_cluster32_kmeans.centroids, 16
)

drawings_cluster32_kD, drawings_cluster32_kI = drawings_cluster32_kmeans.index.search(
    drawings_emb, 1
)
drawings_df.loc[:, "drawings_cluster32_id"] = drawings_cluster32_kI
drawings_df.loc[:, "drawings_cluster32_dist"] = drawings_cluster32_kD
drawings_df.head()
abs_fname rel_fname label pred_label pred_idx pred_probs emb_csv cluster cluster_dist metacluster ... handlabeled_metacluster_was_correct preprocessed_abs_path handlabeled_abs_path emb_csv_cropped drawings_cluster_id drawings_cluster_dist drawings_cropped_cluster_id drawings_cropped_cluster_dist drawings_cluster32_id drawings_cluster32_dist
0 /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/01_FLAT/art/sb77p043.jpg art/sb77p043.jpg art xtra 4 0.168532,0.008473,0.008068,0.016940,0.797986 -0.6198182,-0.5714155,-0.6871516,-0.6553513,-0.6254566,-0.65341413,-0.7267234,-0.4896673,-0.7537334,-0.42715576,1.4904574,-0.72562873,-0.662768,-0.6266761,0.6913696,0.054546177,-0.5467274,-0.6520286,0.117179275,0.94330966,0.5815062,-0.55193967,-0.5446661,-0.6779002,-0.57759243,-0.4584825,-0.3818994,-0.5750927,-0.73986673,-0.45211998,-0.6141643,-0.67007643,-0.52171326,-0.4592305,1.4788612,-0.6186755,0.799198,-0.57338566,-0.17778617,0.10336053,0.093812525,0.17924881,-0.6189488,-0.6682474,2.1040225,-0.59257406,1.6553459,-0.6001429,0.5109105,0.19352531,-0.2517513,-0.66552746,-0.6482407,-0.4732... 11 199.22961 1 ... False /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/10_SIMPLE_CROP/0_drawings/sb77p043.jpg /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/03_VISUAL_HAND_LABELED/0_drawings/sb77p043.jpg -0.6198182,-0.5714155,0.2937309,0.2691822,-0.6254566,-0.46855158,-0.7267234,-0.4896673,-0.7537334,-0.42715576,2.241211,-0.013144195,-0.30681813,-0.6266761,0.43516117,-0.57515705,-0.5467274,-0.5245168,1.3334948,2.1400952,-0.64108604,-0.55193967,-0.5446661,-0.6779002,-0.57759243,-0.6690378,0.38178188,-0.5982413,-0.50063276,-0.21540937,0.4948988,-0.67007643,-0.52171326,-0.4592305,1.8570362,-0.6186755,0.94023055,-0.57338566,0.5270257,-0.6179389,2.302543,1.1004333,0.15528035,-0.6682474,1.890626,-0.59257406,1.331521,-0.6001429,1.5220151,0.93749076,-0.59497476,-0.66552746,-0.6482407,-0.4732165,0.... 3 217.249588 5 332.983734 15 166.716202
1 /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/01_FLAT/art/sb67p021.jpg art/sb67p021.jpg art xtra 4 0.170976,0.008673,0.008480,0.017028,0.794843 1.1073987,0.3512016,-0.73929733,-0.6553513,1.7477593,-0.65341413,0.32179314,-0.4896673,-0.1797334,-0.42715576,1.3163843,-0.72562873,-0.61387855,-0.6266761,-0.35361218,0.37611246,-0.08771938,-0.5262803,0.9261699,-0.6497359,-0.64108604,-0.55193967,-0.5446661,-0.6779002,-0.32559583,-0.6690378,-0.4518578,0.51828945,-0.4238917,-0.45211998,-0.16527033,-0.67007643,1.0136865,-0.4592305,-0.600525,-0.060860336,-0.19446748,-0.24127388,2.2282472,1.8003348,-0.61049384,0.39795423,0.2626753,-0.6682474,-0.75794554,-0.59257406,0.80257696,-0.6001429,-0.651804,-0.028328001,0.53641737,-0.6501347,-0.6482407,0.... 3 132.26111 0 ... True /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/10_SIMPLE_CROP/0_drawings/sb67p021.jpg /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/03_VISUAL_HAND_LABELED/0_drawings/sb67p021.jpg -0.20756221,-0.24843562,0.29454154,-0.6553513,-0.6254566,-0.65341413,-0.7267234,-0.4896673,-0.7537334,-0.42715576,0.9697293,-0.72562873,-0.662768,-0.6266761,-0.23836556,0.4814458,-0.5467274,-0.6520286,0.838902,-0.6497359,-0.57338166,-0.55193967,-0.5446661,-0.28419846,1.6012006,-0.6690378,-0.4518578,-0.0104218125,-0.73986673,-0.3002332,-0.68509877,-0.67007643,-0.36297536,-0.4592305,-0.600525,-0.6186755,-0.73933,-0.57338566,-0.65925777,1.6904012,-0.61049384,-0.58021957,0.508085,0.14767355,0.8082305,-0.59257406,-0.6157326,-0.6001429,-0.651804,-0.30467254,0.17396247,-0.66552746,-0.6482407,-0.0... 2 169.947693 5 126.699768 18 137.920044
2 /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/01_FLAT/art/sb25p227.jpg art/sb25p227.jpg art xtra 4 0.158396,0.008277,0.007424,0.016584,0.809319 1.3776337,-0.5714155,-0.2587232,-0.6553513,1.3532461,-0.65341413,-0.7267234,-0.4896673,-0.7537334,-0.25077122,0.050992966,-0.72562873,0.1406585,-0.6266761,1.0653365,0.96198404,-0.5467274,0.30261123,0.6327609,-0.6497359,-0.64108604,-0.28434965,-0.35651857,-0.6779002,-0.28245115,-0.6690378,-0.4518578,0.030088186,-0.73986673,-0.18931103,-0.041653574,-0.67007643,-0.52171326,-0.29881266,-0.600525,-0.23231092,-0.73933,-0.57338566,-0.65925777,1.8833572,-0.61049384,0.44560486,0.14075392,-0.6682474,-0.75794554,-0.59257406,-0.07511848,-0.6001429,-0.651804,-0.5315948,0.023931146,0.723624,-0.6482407,-... 8 188.58075 0 ... True /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/10_SIMPLE_CROP/0_drawings/sb25p227.jpg /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/03_VISUAL_HAND_LABELED/0_drawings/sb25p227.jpg -0.6198182,-0.428226,-0.73929733,-0.6553513,-0.49369657,-0.65341413,-0.7267234,-0.4896673,-0.7537334,-0.28293163,-0.62038505,-0.32824886,2.5504894,-0.6266761,0.8397537,0.85716057,-0.5467274,-0.058725297,0.64954805,-0.6497359,-0.64108604,-0.36876833,-0.5446661,-0.29563427,0.08626467,-0.6690378,-0.4518578,0.64337015,-0.73986673,0.018805295,-0.68509877,-0.67007643,1.5876667,-0.4592305,-0.600525,-0.6186755,0.28688914,-0.57338566,-0.65925777,1.6810645,-0.61049384,1.8564332,-0.6189488,-0.6682474,-0.75794554,-0.59257406,-0.6157326,-0.6001429,-0.63579994,-0.45296612,-0.29925343,-0.0263654,-0.64824... 3 162.882431 5 257.762512 8 154.434723
3 /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/01_FLAT/art/sb48p057.jpg art/sb48p057.jpg art xtra 4 0.165322,0.008453,0.008010,0.016587,0.801628 2.4936543,0.17563903,-0.6522293,-0.55642915,1.1084181,-0.5028205,-0.046447277,-0.4896673,-0.7537334,-0.42715576,0.84124434,-0.72562873,-0.52445275,-0.5557985,-0.21369287,2.2372599,-0.26381853,-0.6520286,-0.6898426,-0.6497359,-0.64108604,0.43080842,-0.23286673,-0.6779002,0.7969176,-0.6690378,-0.4518578,0.747658,0.04896885,-0.45211998,-0.68509877,-0.2462106,0.7319356,-0.4592305,-0.600525,-0.6186755,-0.5338096,-0.57338566,1.1886733,0.04046011,-0.61049384,0.45326668,0.72983754,-0.6682474,-0.10000485,0.034278154,-0.33160114,-0.6001429,-0.651804,-0.5315948,-0.20898154,-0.66552746,1.2346795,-0.47... 14 90.26291 0 ... True /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/10_SIMPLE_CROP/0_drawings/sb48p057.jpg /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/03_VISUAL_HAND_LABELED/0_drawings/sb48p057.jpg -0.34353483,-0.5714155,2.2665114,-0.6553513,-0.42076486,-0.6254998,-0.7267234,-0.4896673,-0.7537334,-0.42715576,0.6137707,-0.72562873,0.2611376,1.0485492,0.91806084,-0.452704,-0.5467274,-0.6520286,0.621349,-0.6497359,-0.64108604,-0.55193967,-0.5446661,-0.6779002,0.7967064,0.011958599,-0.4518578,-0.25104153,-0.6493137,-0.45211998,-0.02894944,-0.67007643,1.3037661,-0.4592305,-0.600525,-0.6186755,-0.072172046,-0.57338566,0.42140257,0.8994249,-0.61049384,-0.35844505,-0.03452295,-0.40064916,0.1334514,-0.59257406,-0.06328797,-0.6001429,-0.651804,-0.5315948,0.55393887,-0.66552746,-0.6482407,0.165... 4 94.257965 2 145.937225 28 85.081177
4 /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/01_FLAT/art/sb77p044.jpg art/sb77p044.jpg art xtra 4 0.171638,0.008182,0.008061,0.016469,0.795650 2.170152,-0.01916939,-0.47766963,-0.6553513,-0.44795185,-0.65341413,1.5596724,-0.4896673,-0.7537334,-0.42715576,1.0671424,-0.72562873,1.8207353,-0.6266761,-0.6194963,1.1724913,-0.5467274,0.12343103,1.5514618,-0.6497359,0.23890108,-0.55193967,-0.5446661,-0.6779002,-0.57759243,0.33040416,-0.4518578,0.39869583,0.120936334,-0.45211998,-0.68509877,0.2514736,0.17836922,-0.4592305,-0.600525,-0.6186755,-0.73933,-0.57338566,1.3668395,0.6006557,1.2428443,1.0844817,0.36636358,0.48543411,-0.5954572,-0.59257406,-0.30289415,1.2783914,0.5800507,-0.23473695,-0.59497476,-0.66552746,2.2758756,-0.4732165,-0.... 4 176.29102 0 ... True /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/10_SIMPLE_CROP/0_drawings/sb77p044.jpg /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/03_VISUAL_HAND_LABELED/0_drawings/sb77p044.jpg -0.3477007,-0.5714155,-0.73929733,-0.6553513,-0.6254566,-0.65341413,-0.7267234,-0.4896673,-0.7537334,-0.14662892,-0.43905735,-0.64813715,0.059202433,-0.6266761,-0.51404697,-0.20505324,-0.5467274,-0.6520286,1.2549256,-0.6497359,-0.64108604,-0.55193967,-0.5446661,-0.6779002,-0.41643643,-0.6690378,-0.22824319,-0.5982413,-0.73986673,-0.3338361,-0.68509877,0.10866904,-0.1451351,-0.4592305,0.5446466,0.7924262,-0.73933,-0.57338566,-0.45801556,-0.11409092,-0.4252534,0.4120332,-0.6189488,-0.28175777,2.210379,-0.59257406,-0.070759535,-0.6001429,-0.651804,0.012511611,0.26820052,-0.66552746,0.9221995,... 0 173.559937 5 197.142792 25 167.685181

5 rows × 27 columns

show_all_clusters(
    clusters_df=drawings_df,
    clusters=drawings_cluster32_I,
    title="drawings_cluster32_emb",
)

fig = plt.scatter(
    x=drawings_X_tsne[:, 0],
    y=drawings_X_tsne[:, 1],
    c=drawings_df.drawings_cluster32_id,
    s=2.0,
)

drawings_cluster48

ncentroids = 48
niter = 20
verbose = False
drawings_cluster48_kmeans = faiss.Kmeans(
    drawings_emb.shape[1], ncentroids, niter=niter, verbose=verbose, gpu=True
)
drawings_cluster48_kmeans.train(drawings_emb)
drawings_cluster48_D, drawings_cluster48_I = drawings_index.search(
    drawings_cluster48_kmeans.centroids, 16
)

drawings_cluster48_kD, drawings_cluster48_kI = drawings_cluster48_kmeans.index.search(
    drawings_emb, 1
)
drawings_df.loc[:, "drawings_cluster48_id"] = drawings_cluster48_kI
drawings_df.loc[:, "drawings_cluster48_dist"] = drawings_cluster48_kD
drawings_df.head()
abs_fname rel_fname label pred_label pred_idx pred_probs emb_csv cluster cluster_dist metacluster ... drawings_cropped_cluster_id drawings_cropped_cluster_dist drawings_cluster32_id drawings_cluster32_dist drawings_cluster16_id drawings_cluster16_dist drawings_cluster64_id drawings_cluster64_dist drawings_cluster48_id drawings_cluster48_dist
0 /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/01_FLAT/art/sb77p043.jpg art/sb77p043.jpg art xtra 4 0.168532,0.008473,0.008068,0.016940,0.797986 -0.6198182,-0.5714155,-0.6871516,-0.6553513,-0.6254566,-0.65341413,-0.7267234,-0.4896673,-0.7537334,-0.42715576,1.4904574,-0.72562873,-0.662768,-0.6266761,0.6913696,0.054546177,-0.5467274,-0.6520286,0.117179275,0.94330966,0.5815062,-0.55193967,-0.5446661,-0.6779002,-0.57759243,-0.4584825,-0.3818994,-0.5750927,-0.73986673,-0.45211998,-0.6141643,-0.67007643,-0.52171326,-0.4592305,1.4788612,-0.6186755,0.799198,-0.57338566,-0.17778617,0.10336053,0.093812525,0.17924881,-0.6189488,-0.6682474,2.1040225,-0.59257406,1.6553459,-0.6001429,0.5109105,0.19352531,-0.2517513,-0.66552746,-0.6482407,-0.4732... 11 199.22961 1 ... 5 332.983734 15 166.716202 3 169.585052 58 145.230499 15 166.337051
1 /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/01_FLAT/art/sb67p021.jpg art/sb67p021.jpg art xtra 4 0.170976,0.008673,0.008480,0.017028,0.794843 1.1073987,0.3512016,-0.73929733,-0.6553513,1.7477593,-0.65341413,0.32179314,-0.4896673,-0.1797334,-0.42715576,1.3163843,-0.72562873,-0.61387855,-0.6266761,-0.35361218,0.37611246,-0.08771938,-0.5262803,0.9261699,-0.6497359,-0.64108604,-0.55193967,-0.5446661,-0.6779002,-0.32559583,-0.6690378,-0.4518578,0.51828945,-0.4238917,-0.45211998,-0.16527033,-0.67007643,1.0136865,-0.4592305,-0.600525,-0.060860336,-0.19446748,-0.24127388,2.2282472,1.8003348,-0.61049384,0.39795423,0.2626753,-0.6682474,-0.75794554,-0.59257406,0.80257696,-0.6001429,-0.651804,-0.028328001,0.53641737,-0.6501347,-0.6482407,0.... 3 132.26111 0 ... 5 126.699768 18 137.920044 8 141.980621 45 136.906982 45 137.201172
2 /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/01_FLAT/art/sb25p227.jpg art/sb25p227.jpg art xtra 4 0.158396,0.008277,0.007424,0.016584,0.809319 1.3776337,-0.5714155,-0.2587232,-0.6553513,1.3532461,-0.65341413,-0.7267234,-0.4896673,-0.7537334,-0.25077122,0.050992966,-0.72562873,0.1406585,-0.6266761,1.0653365,0.96198404,-0.5467274,0.30261123,0.6327609,-0.6497359,-0.64108604,-0.28434965,-0.35651857,-0.6779002,-0.28245115,-0.6690378,-0.4518578,0.030088186,-0.73986673,-0.18931103,-0.041653574,-0.67007643,-0.52171326,-0.29881266,-0.600525,-0.23231092,-0.73933,-0.57338566,-0.65925777,1.8833572,-0.61049384,0.44560486,0.14075392,-0.6682474,-0.75794554,-0.59257406,-0.07511848,-0.6001429,-0.651804,-0.5315948,0.023931146,0.723624,-0.6482407,-... 8 188.58075 0 ... 5 257.762512 8 154.434723 14 161.993011 61 150.458466 8 148.634705
3 /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/01_FLAT/art/sb48p057.jpg art/sb48p057.jpg art xtra 4 0.165322,0.008453,0.008010,0.016587,0.801628 2.4936543,0.17563903,-0.6522293,-0.55642915,1.1084181,-0.5028205,-0.046447277,-0.4896673,-0.7537334,-0.42715576,0.84124434,-0.72562873,-0.52445275,-0.5557985,-0.21369287,2.2372599,-0.26381853,-0.6520286,-0.6898426,-0.6497359,-0.64108604,0.43080842,-0.23286673,-0.6779002,0.7969176,-0.6690378,-0.4518578,0.747658,0.04896885,-0.45211998,-0.68509877,-0.2462106,0.7319356,-0.4592305,-0.600525,-0.6186755,-0.5338096,-0.57338566,1.1886733,0.04046011,-0.61049384,0.45326668,0.72983754,-0.6682474,-0.10000485,0.034278154,-0.33160114,-0.6001429,-0.651804,-0.5315948,-0.20898154,-0.66552746,1.2346795,-0.47... 14 90.26291 0 ... 2 145.937225 28 85.081177 15 92.158417 28 87.053833 28 83.963623
4 /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/01_FLAT/art/sb77p044.jpg art/sb77p044.jpg art xtra 4 0.171638,0.008182,0.008061,0.016469,0.795650 2.170152,-0.01916939,-0.47766963,-0.6553513,-0.44795185,-0.65341413,1.5596724,-0.4896673,-0.7537334,-0.42715576,1.0671424,-0.72562873,1.8207353,-0.6266761,-0.6194963,1.1724913,-0.5467274,0.12343103,1.5514618,-0.6497359,0.23890108,-0.55193967,-0.5446661,-0.6779002,-0.57759243,0.33040416,-0.4518578,0.39869583,0.120936334,-0.45211998,-0.68509877,0.2514736,0.17836922,-0.4592305,-0.600525,-0.6186755,-0.73933,-0.57338566,1.3668395,0.6006557,1.2428443,1.0844817,0.36636358,0.48543411,-0.5954572,-0.59257406,-0.30289415,1.2783914,0.5800507,-0.23473695,-0.59497476,-0.66552746,2.2758756,-0.4732165,-0.... 4 176.29102 0 ... 5 197.142792 25 167.685181 0 166.856781 21 162.981720 39 169.478943

5 rows × 33 columns

show_all_clusters(
    clusters_df=drawings_df,
    clusters=drawings_cluster48_I,
    title="drawings_cluster48_emb",
)

fig = plt.scatter(
    x=drawings_X_tsne[:, 0],
    y=drawings_X_tsne[:, 1],
    c=drawings_df.drawings_cluster48_id,
    s=2.0,
)

drawings_cluster64

ncentroids = 64
niter = 20
verbose = False
drawings_cluster64_kmeans = faiss.Kmeans(
    drawings_emb.shape[1], ncentroids, niter=niter, verbose=verbose, gpu=True
)
drawings_cluster64_kmeans.train(drawings_emb)
drawings_cluster64_D, drawings_cluster64_I = drawings_index.search(
    drawings_cluster64_kmeans.centroids, 16
)

drawings_cluster64_kD, drawings_cluster64_kI = drawings_cluster64_kmeans.index.search(
    drawings_emb, 1
)
drawings_df.loc[:, "drawings_cluster64_id"] = drawings_cluster64_kI
drawings_df.loc[:, "drawings_cluster64_dist"] = drawings_cluster64_kD
drawings_df.head()
WARNING clustering 1923 points to 64 centroids: please provide at least 2496 training points
abs_fname rel_fname label pred_label pred_idx pred_probs emb_csv cluster cluster_dist metacluster ... drawings_cluster_id drawings_cluster_dist drawings_cropped_cluster_id drawings_cropped_cluster_dist drawings_cluster32_id drawings_cluster32_dist drawings_cluster16_id drawings_cluster16_dist drawings_cluster64_id drawings_cluster64_dist
0 /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/01_FLAT/art/sb77p043.jpg art/sb77p043.jpg art xtra 4 0.168532,0.008473,0.008068,0.016940,0.797986 -0.6198182,-0.5714155,-0.6871516,-0.6553513,-0.6254566,-0.65341413,-0.7267234,-0.4896673,-0.7537334,-0.42715576,1.4904574,-0.72562873,-0.662768,-0.6266761,0.6913696,0.054546177,-0.5467274,-0.6520286,0.117179275,0.94330966,0.5815062,-0.55193967,-0.5446661,-0.6779002,-0.57759243,-0.4584825,-0.3818994,-0.5750927,-0.73986673,-0.45211998,-0.6141643,-0.67007643,-0.52171326,-0.4592305,1.4788612,-0.6186755,0.799198,-0.57338566,-0.17778617,0.10336053,0.093812525,0.17924881,-0.6189488,-0.6682474,2.1040225,-0.59257406,1.6553459,-0.6001429,0.5109105,0.19352531,-0.2517513,-0.66552746,-0.6482407,-0.4732... 11 199.22961 1 ... 3 217.249588 5 332.983734 15 166.716202 3 169.585052 58 145.230499
1 /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/01_FLAT/art/sb67p021.jpg art/sb67p021.jpg art xtra 4 0.170976,0.008673,0.008480,0.017028,0.794843 1.1073987,0.3512016,-0.73929733,-0.6553513,1.7477593,-0.65341413,0.32179314,-0.4896673,-0.1797334,-0.42715576,1.3163843,-0.72562873,-0.61387855,-0.6266761,-0.35361218,0.37611246,-0.08771938,-0.5262803,0.9261699,-0.6497359,-0.64108604,-0.55193967,-0.5446661,-0.6779002,-0.32559583,-0.6690378,-0.4518578,0.51828945,-0.4238917,-0.45211998,-0.16527033,-0.67007643,1.0136865,-0.4592305,-0.600525,-0.060860336,-0.19446748,-0.24127388,2.2282472,1.8003348,-0.61049384,0.39795423,0.2626753,-0.6682474,-0.75794554,-0.59257406,0.80257696,-0.6001429,-0.651804,-0.028328001,0.53641737,-0.6501347,-0.6482407,0.... 3 132.26111 0 ... 2 169.947693 5 126.699768 18 137.920044 8 141.980621 45 136.906982
2 /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/01_FLAT/art/sb25p227.jpg art/sb25p227.jpg art xtra 4 0.158396,0.008277,0.007424,0.016584,0.809319 1.3776337,-0.5714155,-0.2587232,-0.6553513,1.3532461,-0.65341413,-0.7267234,-0.4896673,-0.7537334,-0.25077122,0.050992966,-0.72562873,0.1406585,-0.6266761,1.0653365,0.96198404,-0.5467274,0.30261123,0.6327609,-0.6497359,-0.64108604,-0.28434965,-0.35651857,-0.6779002,-0.28245115,-0.6690378,-0.4518578,0.030088186,-0.73986673,-0.18931103,-0.041653574,-0.67007643,-0.52171326,-0.29881266,-0.600525,-0.23231092,-0.73933,-0.57338566,-0.65925777,1.8833572,-0.61049384,0.44560486,0.14075392,-0.6682474,-0.75794554,-0.59257406,-0.07511848,-0.6001429,-0.651804,-0.5315948,0.023931146,0.723624,-0.6482407,-... 8 188.58075 0 ... 3 162.882431 5 257.762512 8 154.434723 14 161.993011 61 150.458466
3 /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/01_FLAT/art/sb48p057.jpg art/sb48p057.jpg art xtra 4 0.165322,0.008453,0.008010,0.016587,0.801628 2.4936543,0.17563903,-0.6522293,-0.55642915,1.1084181,-0.5028205,-0.046447277,-0.4896673,-0.7537334,-0.42715576,0.84124434,-0.72562873,-0.52445275,-0.5557985,-0.21369287,2.2372599,-0.26381853,-0.6520286,-0.6898426,-0.6497359,-0.64108604,0.43080842,-0.23286673,-0.6779002,0.7969176,-0.6690378,-0.4518578,0.747658,0.04896885,-0.45211998,-0.68509877,-0.2462106,0.7319356,-0.4592305,-0.600525,-0.6186755,-0.5338096,-0.57338566,1.1886733,0.04046011,-0.61049384,0.45326668,0.72983754,-0.6682474,-0.10000485,0.034278154,-0.33160114,-0.6001429,-0.651804,-0.5315948,-0.20898154,-0.66552746,1.2346795,-0.47... 14 90.26291 0 ... 4 94.257965 2 145.937225 28 85.081177 15 92.158417 28 87.053833
4 /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/01_FLAT/art/sb77p044.jpg art/sb77p044.jpg art xtra 4 0.171638,0.008182,0.008061,0.016469,0.795650 2.170152,-0.01916939,-0.47766963,-0.6553513,-0.44795185,-0.65341413,1.5596724,-0.4896673,-0.7537334,-0.42715576,1.0671424,-0.72562873,1.8207353,-0.6266761,-0.6194963,1.1724913,-0.5467274,0.12343103,1.5514618,-0.6497359,0.23890108,-0.55193967,-0.5446661,-0.6779002,-0.57759243,0.33040416,-0.4518578,0.39869583,0.120936334,-0.45211998,-0.68509877,0.2514736,0.17836922,-0.4592305,-0.600525,-0.6186755,-0.73933,-0.57338566,1.3668395,0.6006557,1.2428443,1.0844817,0.36636358,0.48543411,-0.5954572,-0.59257406,-0.30289415,1.2783914,0.5800507,-0.23473695,-0.59497476,-0.66552746,2.2758756,-0.4732165,-0.... 4 176.29102 0 ... 0 173.559937 5 197.142792 25 167.685181 0 166.856781 21 162.981720

5 rows × 31 columns

# show_all_clusters(
#     clusters_df=drawings_df,
#     clusters=drawings_cluster64_I,
#     title="drawings_cluster64_emb",
# )
fig = plt.scatter(
    x=drawings_X_tsne[:, 0],
    y=drawings_X_tsne[:, 1],
    c=drawings_df.drawings_cluster64_id,
    s=2.0,
)

drawings_cropped variations

drawings_cropped_cluster16

ncentroids = 16
niter = 20
verbose = False
drawings_cropped_cluster16_kmeans = faiss.Kmeans(
    drawings_cropped_emb.shape[1], ncentroids, niter=niter, verbose=verbose, gpu=True
)
drawings_cropped_cluster16_kmeans.train(drawings_cropped_emb)
(
    drawings_cropped_cluster16_D,
    drawings_cropped_cluster16_I,
) = drawings_cropped_index.search(drawings_cropped_cluster16_kmeans.centroids, 16)

(
    drawings_cropped_cluster16_kD,
    drawings_cropped_cluster16_kI,
) = drawings_cropped_cluster16_kmeans.index.search(drawings_cropped_emb, 1)
drawings_df.loc[:, "drawings_cropped_cluster16_id"] = drawings_cropped_cluster16_kI
drawings_df.loc[:, "drawings_cropped_cluster16_dist"] = drawings_cropped_cluster16_kD
drawings_df.head()
abs_fname rel_fname label pred_label pred_idx pred_probs emb_csv cluster cluster_dist metacluster ... drawings_cluster32_id drawings_cluster32_dist drawings_cluster16_id drawings_cluster16_dist drawings_cluster64_id drawings_cluster64_dist drawings_cluster48_id drawings_cluster48_dist drawings_cropped_cluster16_id drawings_cropped_cluster16_dist
0 /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/01_FLAT/art/sb77p043.jpg art/sb77p043.jpg art xtra 4 0.168532,0.008473,0.008068,0.016940,0.797986 -0.6198182,-0.5714155,-0.6871516,-0.6553513,-0.6254566,-0.65341413,-0.7267234,-0.4896673,-0.7537334,-0.42715576,1.4904574,-0.72562873,-0.662768,-0.6266761,0.6913696,0.054546177,-0.5467274,-0.6520286,0.117179275,0.94330966,0.5815062,-0.55193967,-0.5446661,-0.6779002,-0.57759243,-0.4584825,-0.3818994,-0.5750927,-0.73986673,-0.45211998,-0.6141643,-0.67007643,-0.52171326,-0.4592305,1.4788612,-0.6186755,0.799198,-0.57338566,-0.17778617,0.10336053,0.093812525,0.17924881,-0.6189488,-0.6682474,2.1040225,-0.59257406,1.6553459,-0.6001429,0.5109105,0.19352531,-0.2517513,-0.66552746,-0.6482407,-0.4732... 11 199.22961 1 ... 15 166.716202 3 169.585052 58 145.230499 15 166.337051 15 265.844086
1 /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/01_FLAT/art/sb67p021.jpg art/sb67p021.jpg art xtra 4 0.170976,0.008673,0.008480,0.017028,0.794843 1.1073987,0.3512016,-0.73929733,-0.6553513,1.7477593,-0.65341413,0.32179314,-0.4896673,-0.1797334,-0.42715576,1.3163843,-0.72562873,-0.61387855,-0.6266761,-0.35361218,0.37611246,-0.08771938,-0.5262803,0.9261699,-0.6497359,-0.64108604,-0.55193967,-0.5446661,-0.6779002,-0.32559583,-0.6690378,-0.4518578,0.51828945,-0.4238917,-0.45211998,-0.16527033,-0.67007643,1.0136865,-0.4592305,-0.600525,-0.060860336,-0.19446748,-0.24127388,2.2282472,1.8003348,-0.61049384,0.39795423,0.2626753,-0.6682474,-0.75794554,-0.59257406,0.80257696,-0.6001429,-0.651804,-0.028328001,0.53641737,-0.6501347,-0.6482407,0.... 3 132.26111 0 ... 18 137.920044 8 141.980621 45 136.906982 45 137.201172 14 121.146545
2 /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/01_FLAT/art/sb25p227.jpg art/sb25p227.jpg art xtra 4 0.158396,0.008277,0.007424,0.016584,0.809319 1.3776337,-0.5714155,-0.2587232,-0.6553513,1.3532461,-0.65341413,-0.7267234,-0.4896673,-0.7537334,-0.25077122,0.050992966,-0.72562873,0.1406585,-0.6266761,1.0653365,0.96198404,-0.5467274,0.30261123,0.6327609,-0.6497359,-0.64108604,-0.28434965,-0.35651857,-0.6779002,-0.28245115,-0.6690378,-0.4518578,0.030088186,-0.73986673,-0.18931103,-0.041653574,-0.67007643,-0.52171326,-0.29881266,-0.600525,-0.23231092,-0.73933,-0.57338566,-0.65925777,1.8833572,-0.61049384,0.44560486,0.14075392,-0.6682474,-0.75794554,-0.59257406,-0.07511848,-0.6001429,-0.651804,-0.5315948,0.023931146,0.723624,-0.6482407,-... 8 188.58075 0 ... 8 154.434723 14 161.993011 61 150.458466 8 148.634705 10 220.298950
3 /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/01_FLAT/art/sb48p057.jpg art/sb48p057.jpg art xtra 4 0.165322,0.008453,0.008010,0.016587,0.801628 2.4936543,0.17563903,-0.6522293,-0.55642915,1.1084181,-0.5028205,-0.046447277,-0.4896673,-0.7537334,-0.42715576,0.84124434,-0.72562873,-0.52445275,-0.5557985,-0.21369287,2.2372599,-0.26381853,-0.6520286,-0.6898426,-0.6497359,-0.64108604,0.43080842,-0.23286673,-0.6779002,0.7969176,-0.6690378,-0.4518578,0.747658,0.04896885,-0.45211998,-0.68509877,-0.2462106,0.7319356,-0.4592305,-0.600525,-0.6186755,-0.5338096,-0.57338566,1.1886733,0.04046011,-0.61049384,0.45326668,0.72983754,-0.6682474,-0.10000485,0.034278154,-0.33160114,-0.6001429,-0.651804,-0.5315948,-0.20898154,-0.66552746,1.2346795,-0.47... 14 90.26291 0 ... 28 85.081177 15 92.158417 28 87.053833 28 83.963623 2 144.254028
4 /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/01_FLAT/art/sb77p044.jpg art/sb77p044.jpg art xtra 4 0.171638,0.008182,0.008061,0.016469,0.795650 2.170152,-0.01916939,-0.47766963,-0.6553513,-0.44795185,-0.65341413,1.5596724,-0.4896673,-0.7537334,-0.42715576,1.0671424,-0.72562873,1.8207353,-0.6266761,-0.6194963,1.1724913,-0.5467274,0.12343103,1.5514618,-0.6497359,0.23890108,-0.55193967,-0.5446661,-0.6779002,-0.57759243,0.33040416,-0.4518578,0.39869583,0.120936334,-0.45211998,-0.68509877,0.2514736,0.17836922,-0.4592305,-0.600525,-0.6186755,-0.73933,-0.57338566,1.3668395,0.6006557,1.2428443,1.0844817,0.36636358,0.48543411,-0.5954572,-0.59257406,-0.30289415,1.2783914,0.5800507,-0.23473695,-0.59497476,-0.66552746,2.2758756,-0.4732165,-0.... 4 176.29102 0 ... 25 167.685181 0 166.856781 21 162.981720 39 169.478943 15 151.277313

5 rows × 35 columns

# show_all_clusters(
#     clusters_df=drawings_df,
#     clusters=drawings_cropped_cluster16_I,
#     title="drawings_cropped_cluster16_emb",
# )
fig = plt.scatter(
    x=drawings_cropped_X_tsne[:, 0],
    y=drawings_cropped_X_tsne[:, 1],
    c=drawings_df.drawings_cropped_cluster16_id,
    s=2.0,
)

drawings_cropped_cluster32

ncentroids = 32
niter = 20
verbose = False
drawings_cropped_cluster32_kmeans = faiss.Kmeans(
    drawings_cropped_emb.shape[1], ncentroids, niter=niter, verbose=verbose, gpu=True
)
drawings_cropped_cluster32_kmeans.train(drawings_cropped_emb)
(
    drawings_cropped_cluster32_D,
    drawings_cropped_cluster32_I,
) = drawings_cropped_index.search(drawings_cropped_cluster32_kmeans.centroids, 16)

(
    drawings_cropped_cluster32_kD,
    drawings_cropped_cluster32_kI,
) = drawings_cropped_cluster32_kmeans.index.search(drawings_cropped_emb, 1)
drawings_df.loc[:, "drawings_cropped_cluster32_id"] = drawings_cropped_cluster32_kI
drawings_df.loc[:, "drawings_cropped_cluster32_dist"] = drawings_cropped_cluster32_kD
drawings_df.head()
abs_fname rel_fname label pred_label pred_idx pred_probs emb_csv cluster cluster_dist metacluster ... drawings_cluster16_id drawings_cluster16_dist drawings_cluster64_id drawings_cluster64_dist drawings_cluster48_id drawings_cluster48_dist drawings_cropped_cluster16_id drawings_cropped_cluster16_dist drawings_cropped_cluster32_id drawings_cropped_cluster32_dist
0 /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/01_FLAT/art/sb77p043.jpg art/sb77p043.jpg art xtra 4 0.168532,0.008473,0.008068,0.016940,0.797986 -0.6198182,-0.5714155,-0.6871516,-0.6553513,-0.6254566,-0.65341413,-0.7267234,-0.4896673,-0.7537334,-0.42715576,1.4904574,-0.72562873,-0.662768,-0.6266761,0.6913696,0.054546177,-0.5467274,-0.6520286,0.117179275,0.94330966,0.5815062,-0.55193967,-0.5446661,-0.6779002,-0.57759243,-0.4584825,-0.3818994,-0.5750927,-0.73986673,-0.45211998,-0.6141643,-0.67007643,-0.52171326,-0.4592305,1.4788612,-0.6186755,0.799198,-0.57338566,-0.17778617,0.10336053,0.093812525,0.17924881,-0.6189488,-0.6682474,2.1040225,-0.59257406,1.6553459,-0.6001429,0.5109105,0.19352531,-0.2517513,-0.66552746,-0.6482407,-0.4732... 11 199.22961 1 ... 3 169.585052 58 145.230499 15 166.337051 15 265.844086 15 257.350555
1 /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/01_FLAT/art/sb67p021.jpg art/sb67p021.jpg art xtra 4 0.170976,0.008673,0.008480,0.017028,0.794843 1.1073987,0.3512016,-0.73929733,-0.6553513,1.7477593,-0.65341413,0.32179314,-0.4896673,-0.1797334,-0.42715576,1.3163843,-0.72562873,-0.61387855,-0.6266761,-0.35361218,0.37611246,-0.08771938,-0.5262803,0.9261699,-0.6497359,-0.64108604,-0.55193967,-0.5446661,-0.6779002,-0.32559583,-0.6690378,-0.4518578,0.51828945,-0.4238917,-0.45211998,-0.16527033,-0.67007643,1.0136865,-0.4592305,-0.600525,-0.060860336,-0.19446748,-0.24127388,2.2282472,1.8003348,-0.61049384,0.39795423,0.2626753,-0.6682474,-0.75794554,-0.59257406,0.80257696,-0.6001429,-0.651804,-0.028328001,0.53641737,-0.6501347,-0.6482407,0.... 3 132.26111 0 ... 8 141.980621 45 136.906982 45 137.201172 14 121.146545 31 122.172424
2 /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/01_FLAT/art/sb25p227.jpg art/sb25p227.jpg art xtra 4 0.158396,0.008277,0.007424,0.016584,0.809319 1.3776337,-0.5714155,-0.2587232,-0.6553513,1.3532461,-0.65341413,-0.7267234,-0.4896673,-0.7537334,-0.25077122,0.050992966,-0.72562873,0.1406585,-0.6266761,1.0653365,0.96198404,-0.5467274,0.30261123,0.6327609,-0.6497359,-0.64108604,-0.28434965,-0.35651857,-0.6779002,-0.28245115,-0.6690378,-0.4518578,0.030088186,-0.73986673,-0.18931103,-0.041653574,-0.67007643,-0.52171326,-0.29881266,-0.600525,-0.23231092,-0.73933,-0.57338566,-0.65925777,1.8833572,-0.61049384,0.44560486,0.14075392,-0.6682474,-0.75794554,-0.59257406,-0.07511848,-0.6001429,-0.651804,-0.5315948,0.023931146,0.723624,-0.6482407,-... 8 188.58075 0 ... 14 161.993011 61 150.458466 8 148.634705 10 220.298950 1 217.335358
3 /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/01_FLAT/art/sb48p057.jpg art/sb48p057.jpg art xtra 4 0.165322,0.008453,0.008010,0.016587,0.801628 2.4936543,0.17563903,-0.6522293,-0.55642915,1.1084181,-0.5028205,-0.046447277,-0.4896673,-0.7537334,-0.42715576,0.84124434,-0.72562873,-0.52445275,-0.5557985,-0.21369287,2.2372599,-0.26381853,-0.6520286,-0.6898426,-0.6497359,-0.64108604,0.43080842,-0.23286673,-0.6779002,0.7969176,-0.6690378,-0.4518578,0.747658,0.04896885,-0.45211998,-0.68509877,-0.2462106,0.7319356,-0.4592305,-0.600525,-0.6186755,-0.5338096,-0.57338566,1.1886733,0.04046011,-0.61049384,0.45326668,0.72983754,-0.6682474,-0.10000485,0.034278154,-0.33160114,-0.6001429,-0.651804,-0.5315948,-0.20898154,-0.66552746,1.2346795,-0.47... 14 90.26291 0 ... 15 92.158417 28 87.053833 28 83.963623 2 144.254028 21 129.951965
4 /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/01_FLAT/art/sb77p044.jpg art/sb77p044.jpg art xtra 4 0.171638,0.008182,0.008061,0.016469,0.795650 2.170152,-0.01916939,-0.47766963,-0.6553513,-0.44795185,-0.65341413,1.5596724,-0.4896673,-0.7537334,-0.42715576,1.0671424,-0.72562873,1.8207353,-0.6266761,-0.6194963,1.1724913,-0.5467274,0.12343103,1.5514618,-0.6497359,0.23890108,-0.55193967,-0.5446661,-0.6779002,-0.57759243,0.33040416,-0.4518578,0.39869583,0.120936334,-0.45211998,-0.68509877,0.2514736,0.17836922,-0.4592305,-0.600525,-0.6186755,-0.73933,-0.57338566,1.3668395,0.6006557,1.2428443,1.0844817,0.36636358,0.48543411,-0.5954572,-0.59257406,-0.30289415,1.2783914,0.5800507,-0.23473695,-0.59497476,-0.66552746,2.2758756,-0.4732165,-0.... 4 176.29102 0 ... 0 166.856781 21 162.981720 39 169.478943 15 151.277313 15 141.268982

5 rows × 37 columns

# show_all_clusters(
#     clusters_df=drawings_df,
#     clusters=drawings_cropped_cluster32_I,
#     title="drawings_cropped_cluster32_emb",
# )
fig = plt.scatter(
    x=drawings_cropped_X_tsne[:, 0],
    y=drawings_cropped_X_tsne[:, 1],
    c=drawings_df.drawings_cropped_cluster32_id,
    s=2.0,
)

drawings_cropped_cluster48

ncentroids = 48
niter = 20
verbose = False
drawings_cropped_cluster48_kmeans = faiss.Kmeans(
    drawings_cropped_emb.shape[1], ncentroids, niter=niter, verbose=verbose, gpu=True
)
drawings_cropped_cluster48_kmeans.train(drawings_cropped_emb)
(
    drawings_cropped_cluster48_D,
    drawings_cropped_cluster48_I,
) = drawings_cropped_index.search(drawings_cropped_cluster48_kmeans.centroids, 16)

(
    drawings_cropped_cluster48_kD,
    drawings_cropped_cluster48_kI,
) = drawings_cropped_cluster48_kmeans.index.search(drawings_cropped_emb, 1)
drawings_df.loc[:, "drawings_cropped_cluster48_id"] = drawings_cropped_cluster48_kI
drawings_df.loc[:, "drawings_cropped_cluster48_dist"] = drawings_cropped_cluster48_kD
drawings_df.head()
abs_fname rel_fname label pred_label pred_idx pred_probs emb_csv cluster cluster_dist metacluster ... drawings_cluster64_id drawings_cluster64_dist drawings_cluster48_id drawings_cluster48_dist drawings_cropped_cluster16_id drawings_cropped_cluster16_dist drawings_cropped_cluster32_id drawings_cropped_cluster32_dist drawings_cropped_cluster48_id drawings_cropped_cluster48_dist
0 /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/01_FLAT/art/sb77p043.jpg art/sb77p043.jpg art xtra 4 0.168532,0.008473,0.008068,0.016940,0.797986 -0.6198182,-0.5714155,-0.6871516,-0.6553513,-0.6254566,-0.65341413,-0.7267234,-0.4896673,-0.7537334,-0.42715576,1.4904574,-0.72562873,-0.662768,-0.6266761,0.6913696,0.054546177,-0.5467274,-0.6520286,0.117179275,0.94330966,0.5815062,-0.55193967,-0.5446661,-0.6779002,-0.57759243,-0.4584825,-0.3818994,-0.5750927,-0.73986673,-0.45211998,-0.6141643,-0.67007643,-0.52171326,-0.4592305,1.4788612,-0.6186755,0.799198,-0.57338566,-0.17778617,0.10336053,0.093812525,0.17924881,-0.6189488,-0.6682474,2.1040225,-0.59257406,1.6553459,-0.6001429,0.5109105,0.19352531,-0.2517513,-0.66552746,-0.6482407,-0.4732... 11 199.22961 1 ... 58 145.230499 15 166.337051 15 265.844086 15 257.350555 15 268.672974
1 /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/01_FLAT/art/sb67p021.jpg art/sb67p021.jpg art xtra 4 0.170976,0.008673,0.008480,0.017028,0.794843 1.1073987,0.3512016,-0.73929733,-0.6553513,1.7477593,-0.65341413,0.32179314,-0.4896673,-0.1797334,-0.42715576,1.3163843,-0.72562873,-0.61387855,-0.6266761,-0.35361218,0.37611246,-0.08771938,-0.5262803,0.9261699,-0.6497359,-0.64108604,-0.55193967,-0.5446661,-0.6779002,-0.32559583,-0.6690378,-0.4518578,0.51828945,-0.4238917,-0.45211998,-0.16527033,-0.67007643,1.0136865,-0.4592305,-0.600525,-0.060860336,-0.19446748,-0.24127388,2.2282472,1.8003348,-0.61049384,0.39795423,0.2626753,-0.6682474,-0.75794554,-0.59257406,0.80257696,-0.6001429,-0.651804,-0.028328001,0.53641737,-0.6501347,-0.6482407,0.... 3 132.26111 0 ... 45 136.906982 45 137.201172 14 121.146545 31 122.172424 31 116.409210
2 /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/01_FLAT/art/sb25p227.jpg art/sb25p227.jpg art xtra 4 0.158396,0.008277,0.007424,0.016584,0.809319 1.3776337,-0.5714155,-0.2587232,-0.6553513,1.3532461,-0.65341413,-0.7267234,-0.4896673,-0.7537334,-0.25077122,0.050992966,-0.72562873,0.1406585,-0.6266761,1.0653365,0.96198404,-0.5467274,0.30261123,0.6327609,-0.6497359,-0.64108604,-0.28434965,-0.35651857,-0.6779002,-0.28245115,-0.6690378,-0.4518578,0.030088186,-0.73986673,-0.18931103,-0.041653574,-0.67007643,-0.52171326,-0.29881266,-0.600525,-0.23231092,-0.73933,-0.57338566,-0.65925777,1.8833572,-0.61049384,0.44560486,0.14075392,-0.6682474,-0.75794554,-0.59257406,-0.07511848,-0.6001429,-0.651804,-0.5315948,0.023931146,0.723624,-0.6482407,-... 8 188.58075 0 ... 61 150.458466 8 148.634705 10 220.298950 1 217.335358 1 213.251678
3 /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/01_FLAT/art/sb48p057.jpg art/sb48p057.jpg art xtra 4 0.165322,0.008453,0.008010,0.016587,0.801628 2.4936543,0.17563903,-0.6522293,-0.55642915,1.1084181,-0.5028205,-0.046447277,-0.4896673,-0.7537334,-0.42715576,0.84124434,-0.72562873,-0.52445275,-0.5557985,-0.21369287,2.2372599,-0.26381853,-0.6520286,-0.6898426,-0.6497359,-0.64108604,0.43080842,-0.23286673,-0.6779002,0.7969176,-0.6690378,-0.4518578,0.747658,0.04896885,-0.45211998,-0.68509877,-0.2462106,0.7319356,-0.4592305,-0.600525,-0.6186755,-0.5338096,-0.57338566,1.1886733,0.04046011,-0.61049384,0.45326668,0.72983754,-0.6682474,-0.10000485,0.034278154,-0.33160114,-0.6001429,-0.651804,-0.5315948,-0.20898154,-0.66552746,1.2346795,-0.47... 14 90.26291 0 ... 28 87.053833 28 83.963623 2 144.254028 21 129.951965 21 140.072540
4 /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/01_FLAT/art/sb77p044.jpg art/sb77p044.jpg art xtra 4 0.171638,0.008182,0.008061,0.016469,0.795650 2.170152,-0.01916939,-0.47766963,-0.6553513,-0.44795185,-0.65341413,1.5596724,-0.4896673,-0.7537334,-0.42715576,1.0671424,-0.72562873,1.8207353,-0.6266761,-0.6194963,1.1724913,-0.5467274,0.12343103,1.5514618,-0.6497359,0.23890108,-0.55193967,-0.5446661,-0.6779002,-0.57759243,0.33040416,-0.4518578,0.39869583,0.120936334,-0.45211998,-0.68509877,0.2514736,0.17836922,-0.4592305,-0.600525,-0.6186755,-0.73933,-0.57338566,1.3668395,0.6006557,1.2428443,1.0844817,0.36636358,0.48543411,-0.5954572,-0.59257406,-0.30289415,1.2783914,0.5800507,-0.23473695,-0.59497476,-0.66552746,2.2758756,-0.4732165,-0.... 4 176.29102 0 ... 21 162.981720 39 169.478943 15 151.277313 15 141.268982 15 145.393372

5 rows × 39 columns

# show_all_clusters(
#     clusters_df=drawings_df,
#     clusters=drawings_cropped_cluster48_I,
#     title="drawings_cropped_cluster48_emb",
# )
fig = plt.scatter(
    x=drawings_cropped_X_tsne[:, 0],
    y=drawings_cropped_X_tsne[:, 1],
    c=drawings_df.drawings_cropped_cluster48_id,
    s=2.0,
)

drawings_cropped_cluster64

ncentroids = 64
niter = 20
verbose = False
drawings_cropped_cluster64_kmeans = faiss.Kmeans(
    drawings_cropped_emb.shape[1], ncentroids, niter=niter, verbose=verbose, gpu=True
)
drawings_cropped_cluster64_kmeans.train(drawings_cropped_emb)
(
    drawings_cropped_cluster64_D,
    drawings_cropped_cluster64_I,
) = drawings_cropped_index.search(drawings_cropped_cluster64_kmeans.centroids, 16)

(
    drawings_cropped_cluster64_kD,
    drawings_cropped_cluster64_kI,
) = drawings_cropped_cluster64_kmeans.index.search(drawings_cropped_emb, 1)
drawings_df.loc[:, "drawings_cropped_cluster64_id"] = drawings_cropped_cluster64_kI
drawings_df.loc[:, "drawings_cropped_cluster64_dist"] = drawings_cropped_cluster64_kD
drawings_df.head()
WARNING clustering 1923 points to 64 centroids: please provide at least 2496 training points
abs_fname rel_fname label pred_label pred_idx pred_probs emb_csv cluster cluster_dist metacluster ... drawings_cluster48_id drawings_cluster48_dist drawings_cropped_cluster16_id drawings_cropped_cluster16_dist drawings_cropped_cluster32_id drawings_cropped_cluster32_dist drawings_cropped_cluster48_id drawings_cropped_cluster48_dist drawings_cropped_cluster64_id drawings_cropped_cluster64_dist
0 /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/01_FLAT/art/sb77p043.jpg art/sb77p043.jpg art xtra 4 0.168532,0.008473,0.008068,0.016940,0.797986 -0.6198182,-0.5714155,-0.6871516,-0.6553513,-0.6254566,-0.65341413,-0.7267234,-0.4896673,-0.7537334,-0.42715576,1.4904574,-0.72562873,-0.662768,-0.6266761,0.6913696,0.054546177,-0.5467274,-0.6520286,0.117179275,0.94330966,0.5815062,-0.55193967,-0.5446661,-0.6779002,-0.57759243,-0.4584825,-0.3818994,-0.5750927,-0.73986673,-0.45211998,-0.6141643,-0.67007643,-0.52171326,-0.4592305,1.4788612,-0.6186755,0.799198,-0.57338566,-0.17778617,0.10336053,0.093812525,0.17924881,-0.6189488,-0.6682474,2.1040225,-0.59257406,1.6553459,-0.6001429,0.5109105,0.19352531,-0.2517513,-0.66552746,-0.6482407,-0.4732... 11 199.22961 1 ... 15 166.337051 15 265.844086 15 257.350555 15 268.672974 58 276.820343
1 /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/01_FLAT/art/sb67p021.jpg art/sb67p021.jpg art xtra 4 0.170976,0.008673,0.008480,0.017028,0.794843 1.1073987,0.3512016,-0.73929733,-0.6553513,1.7477593,-0.65341413,0.32179314,-0.4896673,-0.1797334,-0.42715576,1.3163843,-0.72562873,-0.61387855,-0.6266761,-0.35361218,0.37611246,-0.08771938,-0.5262803,0.9261699,-0.6497359,-0.64108604,-0.55193967,-0.5446661,-0.6779002,-0.32559583,-0.6690378,-0.4518578,0.51828945,-0.4238917,-0.45211998,-0.16527033,-0.67007643,1.0136865,-0.4592305,-0.600525,-0.060860336,-0.19446748,-0.24127388,2.2282472,1.8003348,-0.61049384,0.39795423,0.2626753,-0.6682474,-0.75794554,-0.59257406,0.80257696,-0.6001429,-0.651804,-0.028328001,0.53641737,-0.6501347,-0.6482407,0.... 3 132.26111 0 ... 45 137.201172 14 121.146545 31 122.172424 31 116.409210 34 122.042419
2 /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/01_FLAT/art/sb25p227.jpg art/sb25p227.jpg art xtra 4 0.158396,0.008277,0.007424,0.016584,0.809319 1.3776337,-0.5714155,-0.2587232,-0.6553513,1.3532461,-0.65341413,-0.7267234,-0.4896673,-0.7537334,-0.25077122,0.050992966,-0.72562873,0.1406585,-0.6266761,1.0653365,0.96198404,-0.5467274,0.30261123,0.6327609,-0.6497359,-0.64108604,-0.28434965,-0.35651857,-0.6779002,-0.28245115,-0.6690378,-0.4518578,0.030088186,-0.73986673,-0.18931103,-0.041653574,-0.67007643,-0.52171326,-0.29881266,-0.600525,-0.23231092,-0.73933,-0.57338566,-0.65925777,1.8833572,-0.61049384,0.44560486,0.14075392,-0.6682474,-0.75794554,-0.59257406,-0.07511848,-0.6001429,-0.651804,-0.5315948,0.023931146,0.723624,-0.6482407,-... 8 188.58075 0 ... 8 148.634705 10 220.298950 1 217.335358 1 213.251678 1 191.671631
3 /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/01_FLAT/art/sb48p057.jpg art/sb48p057.jpg art xtra 4 0.165322,0.008453,0.008010,0.016587,0.801628 2.4936543,0.17563903,-0.6522293,-0.55642915,1.1084181,-0.5028205,-0.046447277,-0.4896673,-0.7537334,-0.42715576,0.84124434,-0.72562873,-0.52445275,-0.5557985,-0.21369287,2.2372599,-0.26381853,-0.6520286,-0.6898426,-0.6497359,-0.64108604,0.43080842,-0.23286673,-0.6779002,0.7969176,-0.6690378,-0.4518578,0.747658,0.04896885,-0.45211998,-0.68509877,-0.2462106,0.7319356,-0.4592305,-0.600525,-0.6186755,-0.5338096,-0.57338566,1.1886733,0.04046011,-0.61049384,0.45326668,0.72983754,-0.6682474,-0.10000485,0.034278154,-0.33160114,-0.6001429,-0.651804,-0.5315948,-0.20898154,-0.66552746,1.2346795,-0.47... 14 90.26291 0 ... 28 83.963623 2 144.254028 21 129.951965 21 140.072540 21 144.775696
4 /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/01_FLAT/art/sb77p044.jpg art/sb77p044.jpg art xtra 4 0.171638,0.008182,0.008061,0.016469,0.795650 2.170152,-0.01916939,-0.47766963,-0.6553513,-0.44795185,-0.65341413,1.5596724,-0.4896673,-0.7537334,-0.42715576,1.0671424,-0.72562873,1.8207353,-0.6266761,-0.6194963,1.1724913,-0.5467274,0.12343103,1.5514618,-0.6497359,0.23890108,-0.55193967,-0.5446661,-0.6779002,-0.57759243,0.33040416,-0.4518578,0.39869583,0.120936334,-0.45211998,-0.68509877,0.2514736,0.17836922,-0.4592305,-0.600525,-0.6186755,-0.73933,-0.57338566,1.3668395,0.6006557,1.2428443,1.0844817,0.36636358,0.48543411,-0.5954572,-0.59257406,-0.30289415,1.2783914,0.5800507,-0.23473695,-0.59497476,-0.66552746,2.2758756,-0.4732165,-0.... 4 176.29102 0 ... 39 169.478943 15 151.277313 15 141.268982 15 145.393372 58 151.138092

5 rows × 41 columns

# show_all_clusters(
#     clusters_df=drawings_df,
#     clusters=drawings_cropped_cluster64_I,
#     title="drawings_cropped_cluster64_emb",
# )
fig = plt.scatter(
    x=drawings_cropped_X_tsne[:, 0],
    y=drawings_cropped_X_tsne[:, 1],
    c=drawings_df.drawings_cropped_cluster64_id,
    s=2.0,
)

saving cluster outputs

save the TSV’s with cluster ID’s

preprocessing_dir
'/Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/10_SIMPLE_CROP'
subclusters_dir = (
    singleline_data_home() / "raster/epoch-20231214/04_SUBCLUSTERS"
)

if not os.path.isdir(subclusters_dir):
    os.makedirs(subclusters_dir)
drawings_df.head()
abs_fname rel_fname label pred_label pred_idx pred_probs emb_csv cluster cluster_dist metacluster ... drawings_cluster48_id drawings_cluster48_dist drawings_cropped_cluster16_id drawings_cropped_cluster16_dist drawings_cropped_cluster32_id drawings_cropped_cluster32_dist drawings_cropped_cluster48_id drawings_cropped_cluster48_dist drawings_cropped_cluster64_id drawings_cropped_cluster64_dist
0 /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/01_FLAT/art/sb77p043.jpg art/sb77p043.jpg art xtra 4 0.168532,0.008473,0.008068,0.016940,0.797986 -0.6198182,-0.5714155,-0.6871516,-0.6553513,-0.6254566,-0.65341413,-0.7267234,-0.4896673,-0.7537334,-0.42715576,1.4904574,-0.72562873,-0.662768,-0.6266761,0.6913696,0.054546177,-0.5467274,-0.6520286,0.117179275,0.94330966,0.5815062,-0.55193967,-0.5446661,-0.6779002,-0.57759243,-0.4584825,-0.3818994,-0.5750927,-0.73986673,-0.45211998,-0.6141643,-0.67007643,-0.52171326,-0.4592305,1.4788612,-0.6186755,0.799198,-0.57338566,-0.17778617,0.10336053,0.093812525,0.17924881,-0.6189488,-0.6682474,2.1040225,-0.59257406,1.6553459,-0.6001429,0.5109105,0.19352531,-0.2517513,-0.66552746,-0.6482407,-0.4732... 11 199.22961 1 ... 15 166.337051 15 265.844086 15 257.350555 15 268.672974 58 276.820343
1 /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/01_FLAT/art/sb67p021.jpg art/sb67p021.jpg art xtra 4 0.170976,0.008673,0.008480,0.017028,0.794843 1.1073987,0.3512016,-0.73929733,-0.6553513,1.7477593,-0.65341413,0.32179314,-0.4896673,-0.1797334,-0.42715576,1.3163843,-0.72562873,-0.61387855,-0.6266761,-0.35361218,0.37611246,-0.08771938,-0.5262803,0.9261699,-0.6497359,-0.64108604,-0.55193967,-0.5446661,-0.6779002,-0.32559583,-0.6690378,-0.4518578,0.51828945,-0.4238917,-0.45211998,-0.16527033,-0.67007643,1.0136865,-0.4592305,-0.600525,-0.060860336,-0.19446748,-0.24127388,2.2282472,1.8003348,-0.61049384,0.39795423,0.2626753,-0.6682474,-0.75794554,-0.59257406,0.80257696,-0.6001429,-0.651804,-0.028328001,0.53641737,-0.6501347,-0.6482407,0.... 3 132.26111 0 ... 45 137.201172 14 121.146545 31 122.172424 31 116.409210 34 122.042419
2 /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/01_FLAT/art/sb25p227.jpg art/sb25p227.jpg art xtra 4 0.158396,0.008277,0.007424,0.016584,0.809319 1.3776337,-0.5714155,-0.2587232,-0.6553513,1.3532461,-0.65341413,-0.7267234,-0.4896673,-0.7537334,-0.25077122,0.050992966,-0.72562873,0.1406585,-0.6266761,1.0653365,0.96198404,-0.5467274,0.30261123,0.6327609,-0.6497359,-0.64108604,-0.28434965,-0.35651857,-0.6779002,-0.28245115,-0.6690378,-0.4518578,0.030088186,-0.73986673,-0.18931103,-0.041653574,-0.67007643,-0.52171326,-0.29881266,-0.600525,-0.23231092,-0.73933,-0.57338566,-0.65925777,1.8833572,-0.61049384,0.44560486,0.14075392,-0.6682474,-0.75794554,-0.59257406,-0.07511848,-0.6001429,-0.651804,-0.5315948,0.023931146,0.723624,-0.6482407,-... 8 188.58075 0 ... 8 148.634705 10 220.298950 1 217.335358 1 213.251678 1 191.671631
3 /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/01_FLAT/art/sb48p057.jpg art/sb48p057.jpg art xtra 4 0.165322,0.008453,0.008010,0.016587,0.801628 2.4936543,0.17563903,-0.6522293,-0.55642915,1.1084181,-0.5028205,-0.046447277,-0.4896673,-0.7537334,-0.42715576,0.84124434,-0.72562873,-0.52445275,-0.5557985,-0.21369287,2.2372599,-0.26381853,-0.6520286,-0.6898426,-0.6497359,-0.64108604,0.43080842,-0.23286673,-0.6779002,0.7969176,-0.6690378,-0.4518578,0.747658,0.04896885,-0.45211998,-0.68509877,-0.2462106,0.7319356,-0.4592305,-0.600525,-0.6186755,-0.5338096,-0.57338566,1.1886733,0.04046011,-0.61049384,0.45326668,0.72983754,-0.6682474,-0.10000485,0.034278154,-0.33160114,-0.6001429,-0.651804,-0.5315948,-0.20898154,-0.66552746,1.2346795,-0.47... 14 90.26291 0 ... 28 83.963623 2 144.254028 21 129.951965 21 140.072540 21 144.775696
4 /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/01_FLAT/art/sb77p044.jpg art/sb77p044.jpg art xtra 4 0.171638,0.008182,0.008061,0.016469,0.795650 2.170152,-0.01916939,-0.47766963,-0.6553513,-0.44795185,-0.65341413,1.5596724,-0.4896673,-0.7537334,-0.42715576,1.0671424,-0.72562873,1.8207353,-0.6266761,-0.6194963,1.1724913,-0.5467274,0.12343103,1.5514618,-0.6497359,0.23890108,-0.55193967,-0.5446661,-0.6779002,-0.57759243,0.33040416,-0.4518578,0.39869583,0.120936334,-0.45211998,-0.68509877,0.2514736,0.17836922,-0.4592305,-0.600525,-0.6186755,-0.73933,-0.57338566,1.3668395,0.6006557,1.2428443,1.0844817,0.36636358,0.48543411,-0.5954572,-0.59257406,-0.30289415,1.2783914,0.5800507,-0.23473695,-0.59497476,-0.66552746,2.2758756,-0.4732165,-0.... 4 176.29102 0 ... 39 169.478943 15 151.277313 15 141.268982 15 145.393372 58 151.138092

5 rows × 41 columns

clustered_drawings_tsv_fname = f"{subclusters_dir}/clustered_drawings.tsv"
drawings_df.to_csv(
    clustered_drawings_tsv_fname, index=True, index_label="idx", sep="\t", header=True
)
clustered_drawings_df = pd.read_csv(
    clustered_drawings_tsv_fname, delimiter="\t", index_col="idx"
)
clustered_drawings_df.head()
abs_fname rel_fname label pred_label pred_idx pred_probs emb_csv cluster cluster_dist metacluster ... drawings_cluster48_id drawings_cluster48_dist drawings_cropped_cluster16_id drawings_cropped_cluster16_dist drawings_cropped_cluster32_id drawings_cropped_cluster32_dist drawings_cropped_cluster48_id drawings_cropped_cluster48_dist drawings_cropped_cluster64_id drawings_cropped_cluster64_dist
idx
0 /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/01_FLAT/art/sb77p043.jpg art/sb77p043.jpg art xtra 4 0.168532,0.008473,0.008068,0.016940,0.797986 -0.6198182,-0.5714155,-0.6871516,-0.6553513,-0.6254566,-0.65341413,-0.7267234,-0.4896673,-0.7537334,-0.42715576,1.4904574,-0.72562873,-0.662768,-0.6266761,0.6913696,0.054546177,-0.5467274,-0.6520286,0.117179275,0.94330966,0.5815062,-0.55193967,-0.5446661,-0.6779002,-0.57759243,-0.4584825,-0.3818994,-0.5750927,-0.73986673,-0.45211998,-0.6141643,-0.67007643,-0.52171326,-0.4592305,1.4788612,-0.6186755,0.799198,-0.57338566,-0.17778617,0.10336053,0.093812525,0.17924881,-0.6189488,-0.6682474,2.1040225,-0.59257406,1.6553459,-0.6001429,0.5109105,0.19352531,-0.2517513,-0.66552746,-0.6482407,-0.4732... 11 199.22961 1 ... 15 166.33705 15 265.844100 15 257.350560 15 268.67297 58 276.82034
1 /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/01_FLAT/art/sb67p021.jpg art/sb67p021.jpg art xtra 4 0.170976,0.008673,0.008480,0.017028,0.794843 1.1073987,0.3512016,-0.73929733,-0.6553513,1.7477593,-0.65341413,0.32179314,-0.4896673,-0.1797334,-0.42715576,1.3163843,-0.72562873,-0.61387855,-0.6266761,-0.35361218,0.37611246,-0.08771938,-0.5262803,0.9261699,-0.6497359,-0.64108604,-0.55193967,-0.5446661,-0.6779002,-0.32559583,-0.6690378,-0.4518578,0.51828945,-0.4238917,-0.45211998,-0.16527033,-0.67007643,1.0136865,-0.4592305,-0.600525,-0.060860336,-0.19446748,-0.24127388,2.2282472,1.8003348,-0.61049384,0.39795423,0.2626753,-0.6682474,-0.75794554,-0.59257406,0.80257696,-0.6001429,-0.651804,-0.028328001,0.53641737,-0.6501347,-0.6482407,0.... 3 132.26111 0 ... 45 137.20117 14 121.146545 31 122.172424 31 116.40921 34 122.04242
2 /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/01_FLAT/art/sb25p227.jpg art/sb25p227.jpg art xtra 4 0.158396,0.008277,0.007424,0.016584,0.809319 1.3776337,-0.5714155,-0.2587232,-0.6553513,1.3532461,-0.65341413,-0.7267234,-0.4896673,-0.7537334,-0.25077122,0.050992966,-0.72562873,0.1406585,-0.6266761,1.0653365,0.96198404,-0.5467274,0.30261123,0.6327609,-0.6497359,-0.64108604,-0.28434965,-0.35651857,-0.6779002,-0.28245115,-0.6690378,-0.4518578,0.030088186,-0.73986673,-0.18931103,-0.041653574,-0.67007643,-0.52171326,-0.29881266,-0.600525,-0.23231092,-0.73933,-0.57338566,-0.65925777,1.8833572,-0.61049384,0.44560486,0.14075392,-0.6682474,-0.75794554,-0.59257406,-0.07511848,-0.6001429,-0.651804,-0.5315948,0.023931146,0.723624,-0.6482407,-... 8 188.58075 0 ... 8 148.63470 10 220.298950 1 217.335360 1 213.25168 1 191.67163
3 /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/01_FLAT/art/sb48p057.jpg art/sb48p057.jpg art xtra 4 0.165322,0.008453,0.008010,0.016587,0.801628 2.4936543,0.17563903,-0.6522293,-0.55642915,1.1084181,-0.5028205,-0.046447277,-0.4896673,-0.7537334,-0.42715576,0.84124434,-0.72562873,-0.52445275,-0.5557985,-0.21369287,2.2372599,-0.26381853,-0.6520286,-0.6898426,-0.6497359,-0.64108604,0.43080842,-0.23286673,-0.6779002,0.7969176,-0.6690378,-0.4518578,0.747658,0.04896885,-0.45211998,-0.68509877,-0.2462106,0.7319356,-0.4592305,-0.600525,-0.6186755,-0.5338096,-0.57338566,1.1886733,0.04046011,-0.61049384,0.45326668,0.72983754,-0.6682474,-0.10000485,0.034278154,-0.33160114,-0.6001429,-0.651804,-0.5315948,-0.20898154,-0.66552746,1.2346795,-0.47... 14 90.26291 0 ... 28 83.96362 2 144.254030 21 129.951970 21 140.07254 21 144.77570
4 /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/01_FLAT/art/sb77p044.jpg art/sb77p044.jpg art xtra 4 0.171638,0.008182,0.008061,0.016469,0.795650 2.170152,-0.01916939,-0.47766963,-0.6553513,-0.44795185,-0.65341413,1.5596724,-0.4896673,-0.7537334,-0.42715576,1.0671424,-0.72562873,1.8207353,-0.6266761,-0.6194963,1.1724913,-0.5467274,0.12343103,1.5514618,-0.6497359,0.23890108,-0.55193967,-0.5446661,-0.6779002,-0.57759243,0.33040416,-0.4518578,0.39869583,0.120936334,-0.45211998,-0.68509877,0.2514736,0.17836922,-0.4592305,-0.600525,-0.6186755,-0.73933,-0.57338566,1.3668395,0.6006557,1.2428443,1.0844817,0.36636358,0.48543411,-0.5954572,-0.59257406,-0.30289415,1.2783914,0.5800507,-0.23473695,-0.59497476,-0.66552746,2.2758756,-0.4732165,-0.... 4 176.29102 0 ... 39 169.47894 15 151.277310 15 141.268980 15 145.39337 58 151.13809

5 rows × 41 columns

clustered_watercolors_tsv_fname = f"{subclusters_dir}/clustered_watercolors.tsv"
watercolors_df.to_csv(
    clustered_watercolors_tsv_fname,
    index=True,
    index_label="idx",
    sep="\t",
    header=True,
)
clustered_watercolors_df = pd.read_csv(
    clustered_watercolors_tsv_fname, delimiter="\t", index_col="idx"
)
clustered_watercolors_df.head()
abs_fname rel_fname label pred_label pred_idx pred_probs emb_csv cluster cluster_dist metacluster ... handlabeled_metacluster_name handlabeled_metacluster_id handlabeled_metacluster_was_correct preprocessed_abs_path handlabeled_abs_path emb_csv_cropped watercolors_cluster_id watercolors_cluster_dist watercolors_cropped_cluster_id watercolors_cropped_cluster_dist
idx
0 /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/01_FLAT/art/sb07p104.jpg art/sb07p104.jpg art xtra 4 0.177406,0.008799,0.008245,0.017177,0.788373 -0.39105213,0.96309596,-0.73929733,0.4489988,0.8297614,-0.3937308,-0.7267234,-0.32461396,-0.7537334,-0.42715576,-0.62038505,-0.72562873,0.3037846,-0.6266761,-0.5213815,-0.31669965,-0.5467274,-0.6520286,-0.22544897,-0.6497359,-0.64108604,0.6374447,-0.5446661,-0.6779002,-0.14143991,-0.6690378,-0.44753593,0.66945183,-0.73986673,-0.45211998,-0.05996394,-0.21525535,0.82928157,-0.04412651,-0.600525,-0.04148197,-0.73825717,-0.57338566,-0.25227422,2.3566113,-0.61049384,1.0027854,-0.40134108,1.3733256,-0.75794554,-0.59257406,-0.4395525,-0.6001429,1.0358506,1.1911299,0.8162154,0.032713354,-0.6482407... 5 238.33170 1 ... 1_watercolors 1 True /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/10_SIMPLE_CROP/1_watercolors/sb07p104.jpg /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/03_VISUAL_HAND_LABELED/1_watercolors/sb07p104.jpg -0.6198182,0.8895926,-0.73929733,0.6418346,0.46164584,1.0085131,-0.7267234,-0.4896673,-0.7537334,-0.42715576,-0.62038505,-0.72562873,1.4399182,-0.6266761,0.474914,-0.57515705,-0.5467274,-0.6520286,1.2274435,-0.6497359,-0.27622125,-0.45870692,-0.5446661,-0.6779002,1.3343718,-0.6690378,-0.4518578,0.42277813,-0.73986673,-0.45211998,1.6291834,-0.67007643,-0.09817025,-0.00090405345,-0.600525,-0.6186755,-0.73933,-0.57338566,0.006386578,1.034553,-0.61049384,-0.58021957,-0.09483403,0.78779536,-0.73080033,0.10947651,0.3367887,-0.5382227,-0.26548737,0.5630663,2.15088,0.2266624,-0.6482407,0.049348265... 7 215.02927 7 206.64117
1 /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/01_FLAT/art/sb31p017.jpg art/sb31p017.jpg art xtra 4 0.172119,0.008924,0.008226,0.016950,0.793781 -0.05104202,-0.3935787,-0.73929733,0.86878717,-0.6254566,-0.65341413,-0.7267234,-0.4896673,-0.7537334,-0.14799604,-0.62038505,-0.72562873,-0.2654881,-0.6266761,-0.68991846,-0.57515705,-0.41532665,-0.6520286,-0.6898426,-0.34099144,-0.64108604,-0.55193967,-0.5446661,-0.6779002,-0.2674706,-0.53598946,-0.13334358,-0.5982413,-0.73986673,-0.45211998,-0.68509877,0.033780396,-0.52171326,0.054827005,-0.20721096,0.3301326,-0.73933,-0.57338566,0.34032136,-0.6179389,-0.20170414,0.16225064,-0.44437563,0.44581896,-0.069196045,0.20976627,-0.07846111,-0.6001429,0.38122594,-0.09738222,-0.59497476,-0.665527... 11 191.66959 1 ... 1_watercolors 1 True /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/10_SIMPLE_CROP/1_watercolors/sb31p017.jpg /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/03_VISUAL_HAND_LABELED/1_watercolors/sb31p017.jpg 1.491735,-0.5714155,-0.73929733,0.05867392,0.5154146,0.0936929,-0.7267234,-0.4896673,0.4246894,-0.42715576,-0.33477074,-0.72562873,1.2274611,-0.6266761,-0.68991846,-0.57515705,-0.5467274,1.1312869,-0.06054777,-0.028933167,-0.64108604,-0.55193967,-0.5446661,-0.6779002,-0.57759243,0.46393585,0.4817328,0.22738433,-0.73986673,-0.45211998,0.0057709217,-0.67007643,-0.52171326,0.68283725,0.060967267,0.7253895,-0.73933,-0.57338566,-0.65925777,-0.6179389,-0.32987997,0.86336035,-0.6189488,1.3613329,1.2250904,-0.59257406,-0.5857397,-0.6001429,-0.5687719,-0.14814761,0.5325973,-0.66552746,-0.6482407,0.... 4 199.03098 4 195.97546
2 /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/01_FLAT/art/sb05p079.jpg art/sb05p079.jpg art xtra 4 0.172158,0.008873,0.008536,0.017017,0.793416 1.8089037,-0.5714155,-0.73929733,-0.10773122,-0.22753507,0.34884918,0.124596715,-0.4896673,-0.27447522,-0.42715576,0.61659455,-0.03226477,-0.662768,-0.6266761,-0.68991846,-0.57515705,-0.39897114,-0.6520286,-0.6898426,-0.6497359,0.16184372,-0.55193967,-0.5446661,-0.6779002,0.04647112,-0.6690378,-0.4518578,0.9576235,0.29423904,-0.45211998,-0.68509877,0.09260088,-0.3948297,-0.4592305,-0.600525,-0.6186755,-0.64046603,-0.57338566,0.08902073,0.09568572,-0.61049384,0.7515181,-0.15892029,-0.4098586,1.8483992,-0.59257406,-0.6157326,-0.56642026,-0.651804,-0.44185895,-0.19970179,0.19587982,1.3608505,... 11 140.32997 1 ... 1_watercolors 1 NaN /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/10_SIMPLE_CROP/1_watercolors/sb05p079.jpg /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/03_VISUAL_HAND_LABELED/1_watercolors/sb05p079.jpg -0.6013173,-0.5714155,-0.7368871,-0.6553513,-0.6254566,-0.65341413,0.071327925,-0.4896673,-0.7537334,-0.29406685,1.2854458,-0.72562873,1.4279991,-0.2084853,0.4439276,-0.57515705,-0.5467274,-0.2426523,0.6567551,-0.6497359,0.284827,-0.55193967,-0.5446661,-0.6779002,-0.57759243,-0.6690378,0.39760548,-0.5982413,-0.16403872,0.82081807,-0.68509877,-0.67007643,-0.16007048,-0.23898152,0.4340614,-0.6186755,-0.73933,-0.57338566,-0.65925777,-0.60700464,-0.22504222,1.2887287,0.17025876,-0.5827259,3.245521,-0.59257406,1.607188,-0.6001429,-0.1800242,-0.5315948,0.2059763,0.33526373,0.109642506,-0.0013180... 4 142.76602 4 248.37231
3 /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/01_FLAT/art/sb26p082.jpg art/sb26p082.jpg art xtra 4 0.179525,0.008828,0.008282,0.017196,0.786169 1.8392665,0.3796271,-0.73929733,0.82189727,1.6830277,0.9302285,-0.5532687,-0.4896673,-0.30764756,-0.42715576,-0.44450876,-0.72562873,-0.662768,0.54702616,-0.68991846,-0.57515705,-0.31611928,-0.59368926,1.2819774,-0.6497359,-0.64108604,-0.55193967,0.84984857,-0.6779002,-0.06536412,-0.6690378,0.34403068,-0.16627067,0.3990196,-0.45211998,0.65170527,-0.67007643,0.6049255,-0.4367706,-0.600525,-0.0046679974,-0.73933,-0.109048486,-0.65925777,0.65358853,-0.61049384,0.70374626,-0.6189488,-0.6682474,-0.0177418,-0.59257406,1.1068444,-0.29651338,-0.651804,-0.5315948,1.8200746,-0.66552746,0.11623299,-0... 7 176.11029 1 ... 1_watercolors 1 NaN /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/10_SIMPLE_CROP/1_watercolors/sb26p082.jpg /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/03_VISUAL_HAND_LABELED/1_watercolors/sb26p082.jpg 0.8175719,0.48385304,-0.73929733,1.0291914,1.4682066,1.225123,-0.43518582,-0.4896673,-0.7537334,-0.42715576,0.72162604,-0.72562873,-0.662768,-0.6266761,-0.55470747,-0.57515705,-0.5467274,-0.6520286,2.099903,-0.6497359,-0.64108604,-0.55193967,1.3572993,-0.6779002,1.3149762,0.8512635,0.81857395,-0.5982413,0.056738913,-0.45211998,2.0946088,-0.67007643,-0.52171326,-0.4592305,-0.600525,1.1100725,-0.73933,-0.57338566,-0.24140868,0.9004108,-0.61049384,0.4742828,-0.6189488,-0.6682474,0.335356,0.40166396,0.7790335,-0.6001429,-0.651804,-0.4778452,0.7360641,-0.66552746,-0.6482407,-0.13845,-0.7311095,... 1 157.93832 1 196.84943
4 /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/01_FLAT/art/sb69p101-color.jpg art/sb69p101-color.jpg art xtra 4 0.179525,0.008828,0.008282,0.017196,0.786169 -0.23259398,-0.5714155,-0.73929733,-0.6553513,0.34417403,1.046661,-0.42288247,-0.4896673,0.39017296,-0.42715576,-0.62038505,-0.72562873,-0.662768,-0.6266761,0.93892807,-0.57515705,-0.5222921,-0.6520286,-0.6898426,-0.6497359,-0.6366938,-0.55193967,-0.5446661,-0.6779002,-0.46687827,-0.6690378,-0.4518578,-0.5982413,0.7252437,-0.45211998,1.8137504,-0.67007643,-0.52171326,-0.36457688,-0.600525,0.8178272,-0.73933,0.23574609,-0.65925777,-0.6179389,-0.61049384,-0.15158218,-0.41958112,-0.6682474,-0.75794554,0.4943592,0.8210626,-0.6001429,-0.651804,-0.080083996,0.48374963,-0.42743486,-0.6482407,-0.4... 7 187.45346 1 ... 1_watercolors 1 NaN /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/10_SIMPLE_CROP/1_watercolors/sb69p101-color.jpg /Users/al/Dropbox/2-Areas/2-Sketchbooks/datasets/full-v2/03_VISUAL_HAND_LABELED/1_watercolors/sb69p101-color.jpg 0.14908737,-0.5714155,-0.73929733,0.44245207,-0.6254566,1.4611686,-0.7267234,-0.4896673,0.87923527,-0.42715576,-0.62038505,-0.72562873,-0.662768,-0.6266761,0.4918049,-0.57515705,-0.5467274,-0.6520286,-0.6898426,-0.2860955,-0.64108604,-0.55193967,-0.5446661,-0.6779002,0.69009775,-0.6690378,-0.4518578,0.18292433,-0.004632473,-0.45211998,1.7543458,-0.67007643,-0.52171326,-0.41669255,-0.600525,1.4654884,0.5742926,-0.57338566,-0.65925777,-0.6179389,-0.52983093,0.26484245,-0.25630984,-0.6682474,0.19898295,0.95297796,0.38033813,-0.6001429,-0.651804,-0.5315948,1.3264011,0.31547034,-0.6482407,-0.47... 1 167.27823 1 136.63800

5 rows × 25 columns

drawing_centroids = {
    "drawings_emdb": {
        "drawings_cluster8": (drawings_D.tolist(), drawings_I.tolist()),
        "drawings_cluster16": (
            drawings_cluster16_D.tolist(),
            drawings_cluster16_I.tolist(),
        ),
        "drawings_cluster32": (
            drawings_cluster32_D.tolist(),
            drawings_cluster32_I.tolist(),
        ),
        "drawings_cluster48": (
            drawings_cluster48_D.tolist(),
            drawings_cluster48_I.tolist(),
        ),
        "drawings_cluster64": (
            drawings_cluster64_D.tolist(),
            drawings_cluster64_I.tolist(),
        ),
    },
    "drawings_cropped_emdb": {
        "drawings_cropped_cluster8": (
            drawings_cropped_D.tolist(),
            drawings_cropped_I.tolist(),
        ),
        "drawings_cropped_cluster16": (
            drawings_cropped_cluster16_D.tolist(),
            drawings_cropped_cluster16_I.tolist(),
        ),
        "drawings_cropped_cluster32": (
            drawings_cropped_cluster32_D.tolist(),
            drawings_cropped_cluster32_I.tolist(),
        ),
        "drawings_cropped_cluster48": (
            drawings_cropped_cluster48_D.tolist(),
            drawings_cropped_cluster48_I.tolist(),
        ),
        "drawings_cropped_cluster64": (
            drawings_cropped_cluster64_D.tolist(),
            drawings_cropped_cluster64_I.tolist(),
        ),
    },
}
# see also: https://github.com/facebookresearch/faiss/issues/2087
drawing_centroids_fname = f"{subclusters_dir}/centroids_drawings.json"
with open(drawing_centroids_fname, "w") as outfile:
    json.dump(drawing_centroids, outfile, indent=2)
watercolor_centroids = {
    "watercolors_emdb": {
        "drawings_cluster8": (watercolors_D.tolist(), watercolors_I.tolist()),
    },
    "watercolors_cropped_emdb": {
        "drawings_cropped_cluster8": (
            watercolors_cropped_D.tolist(),
            watercolors_cropped_I.tolist(),
        ),
    },
}
watercolor_centroids_fname = f"{subclusters_dir}/centroids_watercolors.json"
with open(watercolor_centroids_fname, "w") as outfile:
    json.dump(watercolor_centroids, outfile, indent=2)
from pprint import pprint

pprint(watercolor_centroids)
# finish saving