首页 > 解决方案 > 当我使用 MITSceneParsing 数据实现 FCN 时,出现此错误 [TypeError: 'NoneType' object is not subscriptable]

问题描述

我在实现全卷积网络时使用了 MITSceneParsing 数据。但是我收到了这个错误 [TypeError: 'NoneType' object is not subscriptable]。所以有人知道这个原因吗?

import pickle

def read_dataset(data_dir):
    pickle_filename = "MITSceneParsing.pickle"
    pickle_filepath = os.path.join(data_dir, pickle_filename)
    if not os.path.exists(pickle_filepath):
        utils.maybe_download_and_extract(data_dir, DATA_URL, is_zipfile=True)
        SceneParsing_folder = os.path.splitext(DATA_URL.split("\\")[-1])[0]
        result = create_image_lists(os.path.join(data_dir, SceneParsing_folder))
        print("Pickling...")
        with open(pickle_filepath, 'wb') as f:
            pickle.dump(result, f, pickle.HIGHEST_PROTOCOL)
    else:
        print("Found pickle file!")

    with open(pickle_filepath, 'rb') as f:
        result = pickle.load(f)
        training_records = result['training']
        validation_records = result['validation']
        del result

    return training_records, validation_records

标签: pythonpython-3.xpython-2.7tensorflowpickle

解决方案


推荐阅读