--- dataset_info: features: - name: label dtype: class_label: names: '0': The Eiffel Tower '1': The Great Wall of China '2': The Mona Lisa '3': aircraft carrier '4': airplane '5': alarm clock '6': ambulance '7': angel '8': animal migration '9': ant '10': anvil '11': apple '12': arm '13': asparagus '14': axe '15': backpack '16': banana '17': bandage '18': barn '19': baseball '20': baseball bat '21': basket '22': basketball '23': bat '24': bathtub '25': beach '26': bear '27': beard '28': bed '29': bee '30': belt '31': bench '32': bicycle '33': binoculars '34': bird '35': birthday cake '36': blackberry '37': blueberry '38': book '39': boomerang '40': bottlecap '41': bowtie '42': bracelet '43': brain '44': bread '45': bridge '46': broccoli '47': broom '48': bucket '49': bulldozer '50': bus '51': bush '52': butterfly '53': cactus '54': cake '55': calculator '56': calendar '57': camel '58': camera '59': camouflage '60': campfire '61': candle '62': cannon '63': canoe '64': car '65': carrot '66': castle '67': cat '68': ceiling fan '69': cell phone '70': cello '71': chair '72': chandelier '73': church '74': circle '75': clarinet '76': clock '77': cloud '78': coffee cup '79': compass '80': computer '81': cookie '82': cooler '83': couch '84': cow '85': crab '86': crayon '87': crocodile '88': crown '89': cruise ship '90': cup '91': diamond '92': dishwasher '93': diving board '94': dog '95': dolphin '96': donut '97': door '98': dragon '99': dresser '100': drill '101': drums '102': duck '103': dumbbell '104': ear '105': elbow '106': elephant '107': envelope '108': eraser '109': eye '110': eyeglasses '111': face '112': fan '113': feather '114': fence '115': finger '116': fire hydrant '117': fireplace '118': firetruck '119': fish '120': flamingo '121': flashlight '122': flip flops '123': floor lamp '124': flower '125': flying saucer '126': foot '127': fork '128': frog '129': frying pan '130': garden '131': garden hose '132': giraffe '133': goatee '134': golf club '135': grapes '136': grass '137': guitar '138': hamburger '139': hammer '140': hand '141': harp '142': hat '143': headphones '144': hedgehog '145': helicopter '146': helmet '147': hexagon '148': hockey puck '149': hockey stick '150': horse '151': hospital '152': hot air balloon '153': hot dog '154': hot tub '155': hourglass '156': house '157': house plant '158': hurricane '159': ice cream '160': jacket '161': jail '162': kangaroo '163': key '164': keyboard '165': knee '166': knife '167': ladder '168': lantern '169': laptop '170': leaf '171': leg '172': light bulb '173': lighter '174': lighthouse '175': lightning '176': line '177': lion '178': lipstick '179': lobster '180': lollipop '181': mailbox '182': map '183': marker '184': matches '185': megaphone '186': mermaid '187': microphone '188': microwave '189': monkey '190': moon '191': mosquito '192': motorbike '193': mountain '194': mouse '195': moustache '196': mouth '197': mug '198': mushroom '199': nail '200': necklace '201': nose '202': ocean '203': octagon '204': octopus '205': onion '206': oven '207': owl '208': paint can '209': paintbrush '210': palm tree '211': panda '212': pants '213': paper clip '214': parachute '215': parrot '216': passport '217': peanut '218': pear '219': peas '220': pencil '221': penguin '222': piano '223': pickup truck '224': picture frame '225': pig '226': pillow '227': pineapple '228': pizza '229': pliers '230': police car '231': pond '232': pool '233': popsicle '234': postcard '235': potato '236': power outlet '237': purse '238': rabbit '239': raccoon '240': radio '241': rain '242': rainbow '243': rake '244': remote control '245': rhinoceros '246': rifle '247': river '248': roller coaster '249': rollerskates '250': sailboat '251': sandwich '252': saw '253': saxophone '254': school bus '255': scissors '256': scorpion '257': screwdriver '258': sea turtle '259': see saw '260': shark '261': sheep '262': shoe '263': shorts '264': shovel '265': sink '266': skateboard '267': skull '268': skyscraper '269': sleeping bag '270': smiley face '271': snail '272': snake '273': snorkel '274': snowflake '275': snowman '276': soccer ball '277': sock '278': speedboat '279': spider '280': spoon '281': spreadsheet '282': square '283': squiggle '284': squirrel '285': stairs '286': star '287': steak '288': stereo '289': stethoscope '290': stitches '291': stop sign '292': stove '293': strawberry '294': streetlight '295': string bean '296': submarine '297': suitcase '298': sun '299': swan '300': sweater '301': swing set '302': sword '303': syringe '304': t-shirt '305': table '306': teapot '307': teddy-bear '308': telephone '309': television '310': tennis racquet '311': tent '312': tiger '313': toaster '314': toe '315': toilet '316': tooth '317': toothbrush '318': toothpaste '319': tornado '320': tractor '321': traffic light '322': train '323': tree '324': triangle '325': trombone '326': truck '327': trumpet '328': umbrella '329': underwear '330': van '331': vase '332': violin '333': washing machine '334': watermelon '335': waterslide '336': whale '337': wheel '338': windmill '339': wine bottle '340': wine glass '341': wristwatch '342': yoga '343': zebra '344': zigzag - name: packed_drawing dtype: binary splits: - name: train num_bytes: 51960652.42514169 num_examples: 403410 - name: test num_bytes: 12990227.508075692 num_examples: 100853 download_size: 62877590 dataset_size: 64950879.933217384 --- # Quick!Draw! 1pct Sample (per-row bin format) This is a sample 1-percent of the entire 50M-row [QuickDraw! dataset](https://github.com/googlecreativelab/quickdraw-dataset). The row for each drawing contains a byte-encoded packed representation of the drawing and data, which you can unpack using the following snippet: ``` def unpack_drawing(file_handle): key_id, = unpack('Q', file_handle.read(8)) country_code, = unpack('2s', file_handle.read(2)) recognized, = unpack('b', file_handle.read(1)) timestamp, = unpack('I', file_handle.read(4)) n_strokes, = unpack('H', file_handle.read(2)) image = [] n_bytes = 17 for i in range(n_strokes): n_points, = unpack('H', file_handle.read(2)) fmt = str(n_points) + 'B' x = unpack(fmt, file_handle.read(n_points)) y = unpack(fmt, file_handle.read(n_points)) image.append((x, y)) n_bytes += 2 + 2*n_points result = { 'key_id': key_id, 'country_code': country_code, 'recognized': recognized, 'timestamp': timestamp, 'image': image, } return result ``` The `image` in the above is still in line vector format. To convert render this to a raster image (I recommend you do this on-the-fly in a pre-processor): ``` # packed bin -> RGB PIL def binToPIL(packed_drawing): padding = 8 radius = 7 scale = (224.0-(2*padding)) / 256 unpacked = unpack_drawing(io.BytesIO(packed_drawing)) unpacked_image = unpacked['image'] image = np.full((224,224), 255, np.uint8) for stroke in unpacked['image']: prevX = round(stroke[0][0]*scale) prevY = round(stroke[1][0]*scale) for i in range(1, len(stroke[0])): x = round(stroke[0][i]*scale) y = round(stroke[1][i]*scale) cv2.line(image, (padding+prevX, padding+prevY), (padding+x, padding+y), 0, radius, -1) prevX = x prevY = y pilImage = Image.fromarray(image).convert("RGB") return pilImage ```