我的模型正确形成:
public static class ViewHolder extends RecyclerView.ViewHolder implements
View.OnClickListener {
private TextView name;
private TextView comment;
private TextView number;
//private TextView date;
public ViewHolder(View itemView) {
super(itemView);
itemView.setOnClickListener(this);
comment = itemView.findViewById(R.id.textComment);
name = itemView.findViewById(R.id.textName);
number = itemView.findViewById(R.id.editTextNum);
//date = itemView.findViewById(R.id.textDate);
}
@Override
public void onClick(View view) {}
}
@Override
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View inflatedView =
LayoutInflater.from(parent.getContext()).inflate(R.layout
.row_layout, parent, false);
return new ViewHolder(inflatedView);
}
注意,括号已到位。但是当我适应时,我得到以下错误:
model = Sequential()
model.add(Lambda(lambda x:x/255.0 - 0.5, input_shape=(160,320,3)))
model.compile(loss='mse', optimizer='adam')
model.fit(train_generator, samples_per_epoch= len(train_samples), validation_data=validation_generator, nb_val_samples=len(validation_samples), nb_epoch=3)
Traceback (most recent call last): File "modell.py", line 70, in <module>
model.fit(train_generator, samples_per_epoch= len(train_samples), validation_data=validation_generator, nb_val_samples=len(validation_samples), nb_epoch=3)
TypeError: fit() missing 1 required positional argument: 'y'
是一个2D数组
train_generator
我必须失明,因为我无法发现问题。有谁知道为什么train_generator = generator(train_samples, batch_size=32)
正在寻找额外的论点?
答案 0 :(得分:2)
使用生成器进行训练时,必须使用方法model.fit_generator
。
方法fit
将始终要求输入(X)和输出/目标(Y)