我试图在Keras中保存一个模型,它包含多个输入并使用DenseNet,并添加了其他一些层。
在代码末尾,我尝试保存体系结构和权重,似乎权重已正确保存,但是当我尝试保存体系结构时,出现了一条我不理解的错误消息。
请帮助。
命令是:
public IEnumerable<Employee> SelectedEmployees
{
get
{
selectedEmployees = Employees.Where(o => o.IsSelected).ToList();
return selectedEmployees;
}
set
{
selectedEmployees = value;
OnPropertyChanged("SelectedEmployees");
}
}
public bool IsSelected
{
get
{
//Application.Current.Dispatcher.BeginInvoke(new Action(() => MessageBox.Show("SELE")));
return isSelected;
}
set
{
isSelected = value;
OnPropertyChanged("IsSelected");
}
}
public ObservableCollection<Employee> Employees
{
get
{
return employees;
}
set
{
employees = value;
OnPropertyChanged("Employees");
}
}
public ICollectionView FilteredCollection
{
get
{
return filteredCollection;
}
set
{
filteredCollection = value;
OnPropertyChanged("FilteredCollection");
}
}
public Employee SelectedEmployee
{
get
{
//Application.Current.Dispatcher.BeginInvoke(new Action(() => MessageBox.Show(selectedEmployee.SelectedEmployee.ToString())));
return selectedEmployee;
}
set
{
selectedEmployee = value;
if (selectedEmployee == null)
{
ModeOfExecuting = "Searching / Adding Mode";
OnPropertyChanged("SelectedEmployee");
OnPropertyChanged("ModeOfExecuting");
OnPropertyChanged("FilteredCollection");
}
if (selectedEmployee != null)
{
//MessageBox.Show(Employees[SelectedIndex.GetValueOrDefault()].EmployeeName.ToString());
//List<Employee> FilteredCollectionList = FilteredCollection.Cast<Employee>().ToList();
//MessageBox.Show(FilteredCollectionList[0].EmployeeName);
if (selectedEmployee.EmployeeName != string.Empty)
{
RememberValueEmployeeName = selectedEmployee.EmployeeName;
DynamicSearchEmployeeName = RememberValueEmployeeName;
}
if (selectedEmployee.EmployeeID != null)
{
RememberValueEmployeeID = selectedEmployee.EmployeeID;
DynamicSearchEmployeeID = RememberValueEmployeeID;
}
if (selectedEmployee.EmployeeSalary != null)
{
RememberValueEmployeeSalary = selectedEmployee.EmployeeSalary;
DynamicSearchEmployeeSalary = RememberValueEmployeeSalary.ToString();
}
if (selectedEmployee.EmployeeDesigner != string.Empty)
{
RememberValueEmployeeDesigner = selectedEmployee.EmployeeDesigner;
DynamicSearchEmployeeDesigner = RememberValueEmployeeDesigner;
}
if (selectedEmployee.EmployeeEmailID != string.Empty)
{
RememberValueEmployeeEmailID = selectedEmployee.EmployeeEmailID;
DynamicSearchEmployeeEmailID = RememberValueEmployeeEmailID;
}
ModeOfExecuting = "Editing Mode";
OnPropertyChanged("SelectedEmployee");
}
OnPropertyChanged("SelectedEmployee");
}
}
我收到的错误消息是:
# Save the model architecture
with open('model_densenet169_5img_architecture_attention.json', 'w') as f:
f.write(model.to_json())