如何做Tensorflow图像识别?

MarkBMarkB 成员职位:1新手
2021年3月编辑 帮助
我想从“tensorflow_datassets”加载“fashion_mnist”数据集,并使用“深度学习”扩展处理它。
原来的“fashion_mnist”数据是(60000,(28,28,1),(1)),所以,我通过“执行Python”将其转换为BATCH/ID张量:

导入pandas为pd导入numpy为np导入tensorflow为tf导入tensorflow_datassets为TFDS TFDS .disable_progress_bar() image_size = 28 def normalize_img(row): img = row.image.重塑((image_size,image_size))/255.0 img = np。Append (img, [range(image_size)], axis=0) img = np。追加(img, [np.ones (image_size) *行。name], axis=0) img = np.append(img, [np.ones(image_size)*row.label], axis=0) row.image = img.T return row def preprocess_df(df): df.image = df.apply(normalize_img, axis=1) df = pd.DataFrame(np.dstack(df.image.to_numpy()).transpose(2,0,1).reshape(df.shape[0]*image_size,image_size+3)) df.rename(columns={28: 'id', 29:'batch', 30:'label'}, inplace=True) return df def rm_main(): dataset, metadata = tfds.load('fashion_mnist', shuffle_files=True, as_supervised=True, with_info=True) df_train = tfds.as_dataframe(dataset['train'], metadata) df_test = tfds.as_dataframe(dataset['test'], metadata) df_train = preprocess_df(df_train) df_test = preprocess_df(df_test) return df_train, df_test
首先,格式是否正确?
如果我想将Batch设置为32或64。 如何用Rapidminer块重塑张量?
之后我将其转换为张量,用“深度学习(张量)”建立模型,收到警告:
警告:无法在纪元x更新网络
最后,当使用“Apply Model (Generic)”应用它时我收到一个错误:
进程失败:操作符无法执行(getColumn()只能在2D数组上调用)。


process.rmp 12.7 k
    登录注册置评。