这是我的密码:
def get_parser():
parser.add_argument('--batch_size', default=64, help='batch size to train network')
return args
while True:
try:
images_train = np.load(path + str(batch_idx)+'images.npy')
labels_train = np.load(path + str(batch_idx)+'labels.npy')
break
except:
batch_idx = sorted(os.listdir(path))
try:
batch_idx = int(batch_idx[0].split('images.npy')[0])
except:
batch_idx = int(batch_idx[0].split('labels.npy')[0])
batch_idx += 400
batch_idx += 1
feed_dict = {images: images_train[0:args.batch_size],
labels: labels_train[0:args.batch_size], trainable: True}
文件为npz格式,形状为(64112112,3) 代码可以用args.batch\u大小=64,但将出现错误args.batch\u大小=32,如下所示
Traceback (most recent call last):
File "<ipython-input-1-646ff1e212a5>", line 1, in <module>
runfile('D:/InsightFace_TF-master/train_nets_npy_2.py', wdir='D:/InsightFace_TF-master')
File "C:\ProgramData\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 705, in runfile
execfile(filename, namespace)
File "C:\ProgramData\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 102, in execfile
exec(compile(f.read(), filename, 'exec'), namespace)
File "D:/InsightFace_TF-master/train_nets_npy_2.py", line 298, in <module>
feed_dict = {images: images_train[0:args.batch_size], labels: labels_train[0:args.batch_size], trainable: True}
NameError: name 'images_train' is not defined
目前没有回答
相关问题 更多 >
编程相关推荐