起初它工作正常,然后我尝试在创建模型时调整一些参数,之后,
print(model.history.history)
Run Code Online (Sandbox Code Playgroud)
给了我一本空字典。
这是我的完整代码(如果有帮助的话)
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import MinMaxScaler
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dense
from sklearn.metrics import mean_absolute_error
df = pd.read_csv('TF_2_Notebooks_and_Data/DATA/kc_house_data.csv')
# print(df.columns)
'''prints
Index(['id', 'date', 'price', 'bedrooms', 'bathrooms', 'sqft_living',
'sqft_lot', 'floors', 'waterfront', 'view', 'condition', 'grade',
'sqft_above', 'sqft_basement', 'yr_built', 'yr_renovated', 'zipcode',
'lat', 'long', 'sqft_living15', 'sqft_lot15'],
dtype='object')'''
# if we want to see what data column has missing data …Run Code Online (Sandbox Code Playgroud) 无法解决此错误:
tensorflow.python.framework.errors_impl.InvalidArgumentError: logits and labels must have the same first dimension, got logits shape [4,1] and labels shape [12]
[[node sparse_categorical_crossentropy/SparseSoftmaxCrossEntropyWithLogits/SparseSoftmaxCrossEntropyWithLogits (defined at /Users/astro/pythonprojects/covid_chest_xray_image_classification/main.py:86) ]] [Op:__inference_train_function_978]
Function call stack:
train_function
2020-07-17 01:50:11.552216: W tensorflow/core/kernels/data/generator_dataset_op.cc:103] Error occurred when finalizing GeneratorDataset iterator: Failed precondition: Python interpreter state is not initialized. The process may be terminated.
[[{{node PyFunc}}]]
Process finished with exit code 1
Run Code Online (Sandbox Code Playgroud)
我正在尝试根据三个类别对图像进行分类,
如果有帮助,这是我的代码:
# Classification of cases from Chest-xray images
import os
import numpy as np
import matplotlib.pyplot as plt …Run Code Online (Sandbox Code Playgroud) python python-3.x conv-neural-network tensorflow tensorflow2.0