我尝试将authState
与自定义this.fireAuth.authState.subscribe((user: firebase.User) => {
if (user) {
this.getUserData(user.uid);
}
});
和自定义fit_generator
结合使用,但出现以下错误。请告知我应该在哪里更改代码。
1。自定义序列类:
train_sequence_generator
2。 CoLab中的Fit_generator
test_sequence_generator
import os
import numpy as np
from keras.utils import Sequence
from batchGenerator import BatchGenerator
from settings import batch_size, train_folder, test_folder
class SequenceGenerator(Sequence):
def __init__(self, batches_folder):
self.batch_generator = BatchGenerator(folder_name=batches_folder)
self.names = [f for f in os.listdir(batches_folder) if f.lower().endswith('.jpg')]
def __len__(self):
return int(np.ceil(len(self.names) / float(batch_size)))
def __getitem__(self, idx):
print('Getting a bacth{0}'.format(idx))
[X_batch, Y_batch] = self.batch_generator.load_batch_from_disk(idx)
return X_batch, Y_batch
def train_seq_genenrator():
return SequenceGenerator(train_folder)
def test_seq_generator():
return SequenceGenerator(test_folder)
答案 0 :(得分:0)
在新的anaconda环境中安装Keras和TensorFlow,然后开始培训过程为我解决了这个问题。