def attach_image_object_for_each_mood(self):
    with open('qq_big_image.json', 'r', encoding='utf-8') as r:
        data = json.load(r)
    with open('category.json', 'r', encoding='utf-8') as r:
        category = json.load(r)
    category_df = pd.DataFrame(category)
    image_object_df = pd.DataFrame(columns=['tid', 'person', 'vehicle', 'outdoor', 'animal', 'accessory', 'sports', 'kitchen', 'food', 'furniture', 'electronic', 'appliance', 'indoor'])
    i = 0
    for (key, value) in data.items():
        tid = key.split('--')[0].split('/')[(- 1)]
        if (image_object_df.loc[(image_object_df.tid == tid)].shape[0] == 0):
            image_object_df.loc[(i, 'tid')] = tid
            i += 1
        for item in value:
            item = item.split(' ')[0]
            super_cate = category_df.loc[(category_df.name.str.contains(item), 'supercategory')]
            if (len(super_cate) > 0):
                print(super_cate)
                image_object_df.loc[((image_object_df.tid == tid), super_cate.values[0])] = 1
    image_object_df.fillna(0, inplace=True)
    image_object_df['vector'] = 0
    image_object_df['vector'] = image_object_df['tid'].apply((lambda x: image_object_df.loc[(image_object_df.tid == x), 'person':].values[0]))
    image_object_df.to_csv(self.IMAGE_OBJECT_FILE_NAME)
def attach_image_object_for_each_mood(self):
    with open('qq_big_image.json', 'r', encoding='utf-8') as r:
        data = json.load(r)
    with open('category.json', 'r', encoding='utf-8') as r:
        category = json.load(r)
    category_df = pd.DataFrame(category)
    image_object_df = pd.DataFrame(columns=['tid', 'person', 'vehicle', 'outdoor', 'animal', 'accessory', 'sports', 'kitchen', 'food', 'furniture', 'electronic', 'appliance', 'indoor'])
    i = 0
    for (key, value) in data.items():
        tid = key.split('--')[0].split('/')[(- 1)]
        if (image_object_df.loc[(image_object_df.tid == tid)].shape[0] == 0):
            image_object_df.loc[(i, 'tid')] = tid
            i += 1
        for item in value:
            item = item.split(' ')[0]
            super_cate = category_df.loc[(category_df.name.str.contains(item), 'supercategory')]
            if (len(super_cate) > 0):
                print(super_cate)
                image_object_df.loc[((image_object_df.tid == tid), super_cate.values[0])] = 1
    image_object_df.fillna(0, inplace=True)
    image_object_df['vector'] = 0
    image_object_df['vector'] = image_object_df['tid'].apply((lambda x: image_object_df.loc[(image_object_df.tid == x), 'person':].values[0]))
    image_object_df.to_csv(self.IMAGE_OBJECT_FILE_NAME)