from singleline_dataset.embeddings import *
from singleline_dataset.display import *
from singleline_dataset.transforms import *
from singleline_dataset.fileorg import *
tokenize
Fill in a module description here
from pathlib import Path
= Path('/Users/al/Dropbox/2-Areas/2-Sketchbooks')
EXTERNAL_PARENT_DIR = EXTERNAL_PARENT_DIR / 'sketchbooks'
EXTERNAL_SKETCHBOOKS_DIR = EXTERNAL_PARENT_DIR / 'singleline_data'
EXTERNAL_DATA_HOME
= SketchbookEpoch(epoch='20240104', data_home=EXTERNAL_DATA_HOME) EPOCH
no env var SINGLELINE_DATA_HOME, defaulting to: None
from singleline_dataset.tokenize import *
= Stroke3Tokenizer.load(EPOCH.dir_08_THRESHOLDED()) tokenizer
(2048, 3)
TEST: 2024-02-11
= [
toks0 704, 1116, 1312, 418, 1892, 263, 701, 418, 985, 1161, 488,
418, 1745, 418, 1310, 418, 985, 1788, 415, 42, 595, 1761, 1086,
1727, 500, 766, 595, 42, 678, 458, 150, 278, 1029, 150, 1017,
1541, 488, 595, 329, 755, 1745, 1541, 984, 488, 159, 1139, 1546,
488, 415, 1761, 1835, 1310, 1310, 433, 259, 758, 1745, 150, 1029,
1761, 521, 1903, 1203, 521, 150, 1310, 1809, 42, 1086, 415, 150,
893, 1310, 1745, 150, 1745, 1029, 150, 758, 1310, 758, 1761, 1310,
150, 320, 235, 1745, 415, 329, 1745, 1788, 1310, 208, 1310, 1310,
1029, 488, 1310, 1086, 433, 1546, 1086, 1843, 150, 1029, 488, 1727,
329, 1809, 1788, 1310, 1745, 1310, 1029, 1310, 1086, 433, 1029, 758,
329, 1793, 329, 433, 30, 1745, 758, 1745, 1086, 595, 329, 1310,
150, 30, 1310, 150, 1310, 1809, 1029, 278, 1310, 1086, 1843, 329,
150, 899, 1745, 1310, 150, 329, 329, 755, 1310, 150, 150, 1761,
755, 521, 30, 329, 433, 329, 1809, 1745, 758, 329, 1809, 1086,
150, 500, 1310, 521, 1086, 1745, 291, 879, 568, 521, 1861, 1029,
1310, 329, 433, 150, 899, 150, 1745, 1310, 290, 150, 329, 150,
150, 893, 150, 1029, 150, 1310, 1745, 150, 329, 433, 1788, 534,
30, 755, 1310, 290, 1086, 150, 1029, 1745, 415, 1809, 1029, 488,
150, 1086, 150, 1745, 1788, 1358, 521, 1086, 1745, 1745, 1310, 1835,
1310, 150, 1029, 1310, 1086, 150, 1310, 1086, 433, 1310, 1086, 1310,
1086, 150, 534, 1475, 150, 1310, 1086, 150, 2087, 955, 1310, 150,
1086, 766, 278, 1310
]
= [
toks1 80, 647, 1049, 1491, 1729, 686, 807, 1732, 1872, 1267, 42,
1650, 1464, 1410, 2038, 1542, 1115, 1483, 1118, 355, 722, 1262, 1049,
872, 975, 1348, 1799, 1438, 600, 1592, 884, 1592, 547, 1258, 1872,
844, 118, 37, 1875, 1593, 1419, 2036, 1737, 263, 1624, 1032, 1879,
695, 1474, 1043, 345, 1487, 120, 967, 458, 599, 1594, 1520, 1626,
185, 1435, 1655, 847, 301, 894, 1570, 685, 599, 1594, 1520, 239,
212, 2037, 1326, 1481, 1350, 861, 304, 975, 855, 1501, 1647, 1446,
2044, 1412, 1627, 1613, 1446, 413, 1335, 2022, 1817, 135, 1804, 695,
1566, 465, 1341, 1339, 127, 440, 1725, 950, 1975, 430, 1162, 1590,
2005, 1569, 199, 1435, 790, 1640, 1561, 273, 185, 1134, 1474, 1043,
345, 1336, 1649, 190, 1014, 1087, 69, 1917, 1420, 730, 1006, 1058,
448, 1087, 1523, 1330, 1244, 1375, 1501, 828, 1979, 1311, 1875, 1593,
872, 1099, 388, 1737, 141, 1049, 2009, 582, 1940, 1053, 2025, 272,
1302, 1267, 1908, 1718, 1415, 1014, 929, 159, 1912, 1343, 1343, 212,
1343, 123, 200, 2009, 855, 154, 1339, 154, 1490, 1100, 1760, 850,
1640, 345, 37, 7, 1028, 1182, 1446, 1487, 1501, 51, 1613, 354,
273, 1227, 1677, 1490, 1062, 1627, 1721, 1341, 2017, 1339, 675, 872,
910, 441, 652, 828, 76, 1150, 58, 1691, 1905, 1595, 1797, 386,
893, 256, 155, 212, 1343, 212, 1343, 45, 1878, 1542, 42, 1400,
2090
]
= [
toks2 398, 1891, 1211, 1801, 1161, 1540, 526, 405, 377, 885, 309,
985, 1836, 222, 214, 1626, 901, 1161, 1219, 1975, 1198, 1526, 809,
1891, 1267, 1563, 405, 1989, 233, 1541, 343, 1199, 1401, 1098, 501,
927, 1951, 1365, 1029, 1833, 1435, 316, 2021, 863, 1175, 855, 278,
925, 1756, 241, 484, 617, 478, 165, 1687, 158, 1015, 252, 1868,
1453, 253, 698, 722, 1170, 1888, 1802, 947, 1336, 692, 1268, 1732,
772, 1207, 597, 1747, 386, 904, 850, 594, 855, 1192, 1668, 1240,
1015, 174, 112, 118, 839, 263, 1294, 239, 467, 178, 253, 1577,
547, 1229, 842, 674, 662, 828, 1364, 1049, 1318, 178, 467, 62,
283, 1935, 1318, 1207, 562, 2007, 424, 1355, 1732, 647, 1287, 94,
281, 1217, 1936, 343, 851, 1487, 2062
]
= [
toks2 290, 1725, 936, 743, 574, 381, 599, 1005, 799, 1129, 86,
966, 1436, 778, 2000, 140, 1571, 2014, 1680, 1091, 364, 236, 270,
1136, 803, 648, 81, 315, 1021, 1954, 1660, 474, 1440, 1043, 898,
1528, 381, 407, 407, 1431, 192, 921, 1636, 1847, 17, 177, 969,
1725, 140, 1945, 1596, 925, 1986, 1967, 648, 1991, 1400, 523, 157,
601, 342, 321, 1914, 1890, 342, 504, 623, 221, 1244, 379, 86,
131, 224, 24, 585, 729, 1880, 1044, 1287, 624, 1145, 1484, 1355,
435, 24, 537, 86, 1027, 1332, 1037, 69, 1254, 1257, 165, 946,
55, 601, 485, 168, 771, 2028, 1195, 1389, 589, 1725, 986, 1805,
1156, 192, 894, 1117, 506, 321, 1175, 1255, 232, 1351, 1363, 1204,
87, 525, 1541, 1931, 2006, 856, 301, 1557, 808, 146, 815, 1210,
341, 713, 255, 959, 813, 376, 616, 1485, 1738, 584, 893, 629,
804, 1897, 1294, 1617, 370, 1175, 363, 643, 1439, 2096
]
= [
toks2 290, 1627, 815, 434, 1528, 1634, 1223, 818, 1914, 1303, 349,
770, 1683, 648, 1654, 649, 254, 903, 1203, 1950, 1531, 1094, 1449,
59, 614, 370, 980, 741, 563, 12, 1739, 1537, 1620, 11, 463,
1605, 1518, 364, 1562, 1739, 1038, 1976, 1356, 1530, 12, 1734, 792,
1181, 134, 426, 1990, 2029, 1348, 1785, 471, 171, 804, 589, 811,
1108, 563, 1947, 712, 1976, 1502, 537, 1748, 1785, 1487, 1986, 1512,
1006, 1005, 342, 1511, 1962, 1292, 858, 246, 1943, 1540, 1198, 1623,
876, 1540, 622, 1321, 884, 1010, 255, 295, 627, 1367, 1003, 1585,
1701, 1185, 1175, 232, 1601, 818, 474, 1390, 624, 1634, 1261, 379,
108, 1893, 1793, 1077, 1693, 829, 1966, 192, 1145, 1542, 779, 1084,
452, 556, 643, 1116, 1951, 265, 394, 157, 1900, 1945, 1277, 1966,
1542, 1614, 1951, 1470, 672, 1790, 86, 380, 1245, 1449, 379, 831,
1409, 1824, 1955, 379, 1003, 55, 1084, 452, 208, 1972, 847, 1151,
585, 560, 1227, 648, 537, 1175, 1477, 1614, 324, 384, 272, 574,
1448, 422, 771, 992, 1255, 1150, 1391, 617, 1400, 304, 1998, 997,
1735, 1337, 1712, 402, 2090
]
# toks2 = [290, 1725, 936, 743, 574, 381, 599, 1005]
= [
toks2 56, 562, 1168, 728, 915, 323, 1184, 572, 1375, 598, 765,
1375, 1317, 1761, 79, 1028, 219, 1719, 733, 226, 1872, 531, 1142,
1977, 1450, 79, 1753, 628, 694, 1670, 1071, 612, 79, 1630, 754,
301, 172, 1548, 1339, 179, 1188, 633, 707, 1339, 1816, 695, 1235,
1053, 602, 1465, 802, 1872, 553, 1521, 1592, 1393, 1137, 1492, 60,
1067, 805, 1951, 274, 596, 1457, 473, 2009, 1078, 2025, 388, 1193,
362, 1801, 1853, 1296, 1493, 110, 643, 338, 1147, 1503, 1687, 536,
1045, 760, 647, 1365, 1600, 1900, 243, 622, 237, 18, 2032, 304,
1503, 1342, 8, 1238, 650, 1183, 969, 185, 1067, 74, 1155, 469,
836, 1459, 1606, 1481, 1850, 1475, 914, 297, 713, 671, 600, 815,
58, 2036, 1867, 193, 970, 543, 590, 612, 1768, 1417, 1882, 1061,
1474, 161, 1764, 1998, 1229, 522, 1402, 279, 668, 2037, 438, 233,
1086, 2016, 915, 683, 564, 412, 1555, 407, 1326, 1784, 1450, 409,
1025, 517, 1778, 498, 1519, 728, 990, 1575, 469, 610, 2039, 1678,
299, 1810, 20, 1125, 161, 1921, 751, 2027, 1779, 1230, 2037, 1083,
1148, 339, 2009, 1938, 2039, 395, 1639, 975, 1548, 2032, 1630, 79,
667, 1554, 1867, 439, 872, 474, 658, 1893, 1029, 193, 168, 1308,
1844, 650, 1545, 251, 325, 1515, 1839, 460, 1350, 1427, 355, 1878,
1609, 1537, 1692, 304, 301, 1928, 1289, 164, 1545, 156, 1213, 540,
193, 766, 2088
]
= [
toks2 56, 562, 1168, 728, 915, 323, 1184, 572, 1375, 598, 765,
1375, 1317, 1761, 79, 1028, 219, 1719, 733, 226, 1872, 531, 1142,
1977, 1450, 79, 1753, 628, 694, 1670, 1071, 612, 79, 1630, 754,
301, 172, 1548, 1339, 179, 1188, 633, 707, 1339, 1816, 695, 1235,
1053, 602, 1465, 802, 1872, 553, 1521, 1592, 1393, 1137, 1492, 60,
1067, 805, 1951, 274, 596, 1457, 473, 2009, 1078, 2025, 388, 1193,
362, 1801, 1853, 1296, 1493, 110, 643, 338, 1147, 1503, 1687, 536,
1045, 760, 647, 1365, 1600, 1900, 243, 622, 237, 18, 2032, 304,
1503, 1342, 8, 1238, 650, 1183, 969, 185, 1067, 74, 1155, 469,
836, 1459, 1606, 1481, 1850, 1475, 914, 297, 713, 671, 600, 815,
58, 2036, 1867, 193, 970, 543, 590, 612, 1768, 1417, 1882, 1061,
1474, 161, 1764, 1998, 1229, 522, 1402, 279, 668, 2037, 438, 233,
1086, 2016, 915, 683, 564, 412, 1555, 407, 1326, 1784, 1450, 409,
1025, 517, 1778, 498, 1519, 728, 990, 1575, 469, 610, 2039, 1678,
299, 1810, 20, 1125, 161, 1921, 751, 2027, 1779, 1230, 2037, 1083,
1148, 339, 2009, 1938, 2039, 395, 1639, 975, 1548, 2032, 1630, 79,
667, 1554, 1867, 439, 872, 474, 658, 1893, 1029, 193, 168, 1308,
1844, 650, 1545, 251, 325, 1515, 1839, 460, 1350, 1427, 355, 1878,
1609, 1537, 1692, 304, 301, 1928, 1289, 164, 1545, 156, 1213, 540,
193, 766, 2088
]
= [
toks2 398, 1970, 1645, 1757, 845, 145, 1987, 975, 1166, 1306, 715,
87, 166, 84, 701, 225, 1972, 617, 2024, 1610, 1876, 702, 430,
1944, 104, 1226, 885, 1763, 1294, 119, 418, 1194, 306, 1484, 1201,
1355, 1404, 40, 1787, 274, 1787, 1536, 1447, 966, 1404, 1219, 61,
99, 1944, 685, 1226, 1833, 808, 685, 1613, 1595, 966, 903, 99,
944, 407, 702, 14, 178, 1147, 1139, 1400, 307, 130, 1764, 1660,
1607, 313, 288, 1488, 1686, 1074, 1170, 1035, 283, 278, 617, 1755,
568, 488, 418, 502, 16, 1710, 1704, 627, 1025, 988, 1371, 502,
932, 439, 1991, 480, 1973, 1441, 1488, 475, 241, 1005, 988, 1598,
905, 698, 1901, 1569, 616, 463, 1940, 1432, 1868, 944, 544, 1059,
2030, 1887, 19, 779, 1763, 1879, 1281, 1504, 1373, 1043, 1826, 40,
616, 1177, 158, 119, 225, 740, 793, 698, 905, 881, 1422, 68,
1750, 698, 709, 1815, 307, 954, 1907, 697, 40, 1292, 1787, 1447,
1441, 1070, 1197, 1219, 1958, 906, 513, 186, 87, 960, 938, 1360,
1944, 18, 404, 778, 740, 663, 2030, 2042, 1710, 1178, 222, 627,
99, 1947, 361, 444, 1470, 283, 84, 517, 1973, 815, 553, 104,
1660, 988, 636, 836, 1294, 1698, 634, 1064, 1292, 1046, 1580, 634,
1515, 225, 1633, 1242, 1897, 1180, 1217, 1702, 1884, 881, 439, 709,
1675, 1292, 1474, 345, 1927, 184, 698, 1771, 666, 462, 1978, 176,
2012, 1676, 40, 1040, 616, 1973, 372, 1970, 839, 222, 1373, 493,
18, 1043, 1441, 1320, 1219, 2089
]
= [398, 1970, 1645, 1757]
toks2 = [
toks2 398, 1970, 1645, 1757, 845, 145, 1987, 975, 1166, 1306, 715,
87, 166, 84, 701, 225, 1972, 617, 2024, 1610, 1876, 702, 430,
1944, 104, 1226, 885, 1763, 1294, 119, 418, 1194, 306, 1484, 1201,
1355, 1404, 40, 1787, 274, 1787, 1536, 1447, 966, 1404, 1219, 61,
99, 1944, 685, 1226, 1833, 808, 685, 1613, 1595, 966, 903, 99,
944, 407, 702, 14, 178, 1147, 1139, 1400, 307, 130, 1764, 1660,
1607, 313, 288, 1488, 1686, 1074, 1170, 1035, 283, 278, 617, 1755,
568, 488, 418, 502, 16, 1710, 1704, 627, 1025, 988, 1371, 502,
932, 439, 1991, 480, 1973, 1441, 1488, 475, 241, 1005, 988, 1598,
905, 698, 1901, 1569, 616, 463, 1940, 1432, 1868, 944, 544, 1059,
2030, 1887, 19, 779, 1763, 1879, 1281, 1504, 1373, 1043, 1826, 40,
616, 1177, 158, 119, 225, 740, 793, 698, 905, 881, 1422, 68,
1750, 698, 709, 1815, 307, 954, 1907, 697, 40, 1292, 1787, 1447,
1441, 1070, 1197, 1219, 1958, 906, 513, 186, 87, 960, 938, 1360,
1944, 18, 404, 778, 740, 663, 2030, 2042, 1710, 1178, 222, 627,
99, 1947, 361, 444, 1470, 283, 84, 517, 1973, 815, 553, 104,
1660, 988, 636, 836, 1294, 1698, 634, 1064, 1292, 1046, 1580, 634,
1515, 225, 1633, 1242, 1897, 1180, 1217, 1702, 1884, 881, 439, 709,
1675, 1292, 1474, 345, 1927, 184, 698, 1771, 666, 462, 1978, 176,
2012, 1676, 40, 1040, 616, 1973, 372, 1970, 839, 222, 1373, 493,
18, 1043, 1441, 1320, 1219, 2089
]
#### 2024-02-13
= [
toks2 2053, 1049, 2017, 1480, 237, 1188, 43, 1650, 45, 546, 45,
546, 45, 45, 45, 141, 995, 975, 1188, 53, 1061, 1916, 185,
1975, 1124, 160, 693, 1468, 376, 1898, 1737, 2025, 995, 871, 950,
1322, 1059, 1468, 376, 1898, 1741, 135, 1314, 16, 1611, 1924, 1061,
300, 752, 1969, 1130, 161, 1626, 1335, 253, 841, 822, 118, 1872,
1490, 1640, 1182, 1585, 1217, 963, 45, 1481, 2017, 304, 1255, 141,
301, 562, 437, 535, 1240, 546, 543, 1450, 2033, 579, 1071, 2027,
1585, 1217, 1751, 716, 1071, 524, 1834, 524, 1834, 524, 1834, 524,
1834, 524, 1834, 524, 1834, 1834, 1834, 1834, 1834, 1834, 1834, 1955,
120, 1640, 185, 72, 1418, 1737, 1737, 1737, 1737, 1737, 1737, 1737,
1737, 1737, 1737, 1737, 1737, 1737, 1737, 1737, 1737, 1737, 1737, 1737,
582, 1737, 528, 950, 2025, 1481, 1481, 1481, 1481, 45, 1343, 211,
1339, 45, 1343, 45, 1420, 1363, 1937, 1217, 1578, 1924, 376, 1028,
1640, 1723, 1182, 717, 527, 45, 1032, 91, 1363, 45, 1408, 1341,
1280, 956, 1650, 304, 1341, 1280, 1732, 1631, 1061, 275, 1618, 1511,
1335, 1327
]
from singleline_dataset.transforms import *
= tokenizer.decode(toks2)
deltas2 = deltas_to_points(deltas2)
points2
= BoundingBox.create(points2)
bb2 = apply_transform(points2[:,:2], bb2.normalization_xform(scale=200.0))
normed_points2 2] = points2[:,2]
normed_points2[:,
plot_strokes(points_to_strokes(normed_points2))