TypeError: 'range' object does not support item assignment

File "F:\Program Files\Python\Python36\lib\random.py", line 275, in shuffle
    x[i], x[j] = x[j], x[i]
TypeError: 'range' object does not support item assignmen

解决方法
random.shuffle(shuffled_index)的对象必须要为object 类型

修改
shuffled_index = range(len(filenames))
shuffled_index = list(range(len(filenames)))

你可能感兴趣的:(深度学习,图像分类)