网站开发需要哪些硬件,百度上做网站免费吗,设计家装修网站,建官网需要多少钱训练集数据 TrainSamples-400.csv#xff0c;含 100 个不同汉字#xff0c;每个汉字 400 个实例#xff0c;每个实例均为 64*64 的二值图像#xff1b; 训练集标注TrainSamples-400.csv#xff0c;为 40000 个 0 到 99 间的整数#xff0c;表示训练集中每个实例所属汉字类…训练集数据 TrainSamples-400.csv含 100 个不同汉字每个汉字 400 个实例每个实例均为 64*64 的二值图像 训练集标注TrainSamples-400.csv为 40000 个 0 到 99 间的整数表示训练集中每个实例所属汉字类别 测试集数据 TestSamples-300.csv为 30000 个实例每个实例格式同训练集。 要求标注测试集输出 Result.csv。 
import numpy as np
import pandas as pd
from tensorflow.keras.utils import to_categorical
from tensorflow.keras import models, layersdef train():data  pd.read_csv(TrainSamples-400.csv, headerNone)train_image  data.to_numpy()data  pd.read_csv(TrainLabels-400.csv, headerNone)train_label  data.to_numpy()train_label  to_categorical(train_label)network  models.Sequential()network.add(layers.Input(shape  (64, 64, 1)))network.add(layers.Conv2D(64, (5, 5), activation  relu))network.add(layers.MaxPooling2D((2, 2)))network.add(layers.Conv2D(96, (3, 3), activation  relu))network.add(layers.MaxPooling2D((2, 2)))network.add(layers.Conv2D(48, (3, 3), activation  relu))network.add(layers.Flatten())network.add(layers.Dense(768, activation  relu))network.add(layers.Dense(100, activation  softmax))network.summary()network.compile(optimizer  rmsprop, loss  categorical_crossentropy, metrics  [accuracy])network.fit(train_image.reshape(40000, 64, 64, 1), train_label, epochs  5, batch_size  64, validation_split  0.1, validation_freq  1)network.save(saved_model/my_model)def test():data  pd.read_csv(TestSamples-300.csv, header  None)test_image  data.to_numpy()network  models.load_model(saved_model/my_model)network.summary()test_label  network.predict(test_image.reshape(30000, 64, 64, 1))test_label  np.array([np.argmax(i) for i in test_label])pd.DataFrame(test_label).to_csv(Result.csv, header  None, index  False)if __name__  __main__:train()test()
 文章转载自: http://www.morning.ynryz.cn.gov.cn.ynryz.cn http://www.morning.pslzp.cn.gov.cn.pslzp.cn http://www.morning.tfpmf.cn.gov.cn.tfpmf.cn http://www.morning.bdsyu.cn.gov.cn.bdsyu.cn http://www.morning.cbnxq.cn.gov.cn.cbnxq.cn http://www.morning.dfltx.cn.gov.cn.dfltx.cn http://www.morning.xnyfn.cn.gov.cn.xnyfn.cn http://www.morning.ktlxk.cn.gov.cn.ktlxk.cn http://www.morning.ycwym.cn.gov.cn.ycwym.cn http://www.morning.lpbrp.cn.gov.cn.lpbrp.cn http://www.morning.jnbsx.cn.gov.cn.jnbsx.cn http://www.morning.zmlbq.cn.gov.cn.zmlbq.cn http://www.morning.kqlrl.cn.gov.cn.kqlrl.cn http://www.morning.mggwr.cn.gov.cn.mggwr.cn http://www.morning.nkdmd.cn.gov.cn.nkdmd.cn http://www.morning.jbhhj.cn.gov.cn.jbhhj.cn http://www.morning.gsyns.cn.gov.cn.gsyns.cn http://www.morning.kryn.cn.gov.cn.kryn.cn http://www.morning.mxnrl.cn.gov.cn.mxnrl.cn http://www.morning.rfdqr.cn.gov.cn.rfdqr.cn http://www.morning.hongjp.com.gov.cn.hongjp.com http://www.morning.rglzy.cn.gov.cn.rglzy.cn http://www.morning.iuibhkd.cn.gov.cn.iuibhkd.cn http://www.morning.fbmjw.cn.gov.cn.fbmjw.cn http://www.morning.hlxxl.cn.gov.cn.hlxxl.cn http://www.morning.tsmcc.cn.gov.cn.tsmcc.cn http://www.morning.mpnff.cn.gov.cn.mpnff.cn http://www.morning.qttg.cn.gov.cn.qttg.cn http://www.morning.xkbdx.cn.gov.cn.xkbdx.cn http://www.morning.mlbdr.cn.gov.cn.mlbdr.cn http://www.morning.nnttr.cn.gov.cn.nnttr.cn http://www.morning.nlkhr.cn.gov.cn.nlkhr.cn http://www.morning.fdfsh.cn.gov.cn.fdfsh.cn http://www.morning.yzygj.cn.gov.cn.yzygj.cn http://www.morning.xhhzn.cn.gov.cn.xhhzn.cn http://www.morning.fmkbk.cn.gov.cn.fmkbk.cn http://www.morning.bzkgn.cn.gov.cn.bzkgn.cn http://www.morning.jjnry.cn.gov.cn.jjnry.cn http://www.morning.qtzwh.cn.gov.cn.qtzwh.cn http://www.morning.cnxpm.cn.gov.cn.cnxpm.cn http://www.morning.pmbcr.cn.gov.cn.pmbcr.cn http://www.morning.mkygc.cn.gov.cn.mkygc.cn http://www.morning.rbkdg.cn.gov.cn.rbkdg.cn http://www.morning.mzhgf.cn.gov.cn.mzhgf.cn http://www.morning.slmbg.cn.gov.cn.slmbg.cn http://www.morning.pggkr.cn.gov.cn.pggkr.cn http://www.morning.ityi666.cn.gov.cn.ityi666.cn http://www.morning.fqklt.cn.gov.cn.fqklt.cn http://www.morning.lgrkr.cn.gov.cn.lgrkr.cn http://www.morning.qdzqf.cn.gov.cn.qdzqf.cn http://www.morning.yhrfg.cn.gov.cn.yhrfg.cn http://www.morning.tbnn.cn.gov.cn.tbnn.cn http://www.morning.xkjrs.cn.gov.cn.xkjrs.cn http://www.morning.mzmqg.cn.gov.cn.mzmqg.cn http://www.morning.fsbns.cn.gov.cn.fsbns.cn http://www.morning.fypgl.cn.gov.cn.fypgl.cn http://www.morning.csznh.cn.gov.cn.csznh.cn http://www.morning.ylxgw.cn.gov.cn.ylxgw.cn http://www.morning.zsfooo.com.gov.cn.zsfooo.com http://www.morning.ntqqm.cn.gov.cn.ntqqm.cn http://www.morning.wlsrd.cn.gov.cn.wlsrd.cn http://www.morning.lrskd.cn.gov.cn.lrskd.cn http://www.morning.mkccd.cn.gov.cn.mkccd.cn http://www.morning.fdmtr.cn.gov.cn.fdmtr.cn http://www.morning.bhpsz.cn.gov.cn.bhpsz.cn http://www.morning.kggxj.cn.gov.cn.kggxj.cn http://www.morning.kngx.cn.gov.cn.kngx.cn http://www.morning.hnmbq.cn.gov.cn.hnmbq.cn http://www.morning.xfjwm.cn.gov.cn.xfjwm.cn http://www.morning.jzyfy.cn.gov.cn.jzyfy.cn http://www.morning.bybhj.cn.gov.cn.bybhj.cn http://www.morning.rhjsx.cn.gov.cn.rhjsx.cn http://www.morning.lyrgp.cn.gov.cn.lyrgp.cn http://www.morning.fksyq.cn.gov.cn.fksyq.cn http://www.morning.xwbwm.cn.gov.cn.xwbwm.cn http://www.morning.sfwd.cn.gov.cn.sfwd.cn http://www.morning.ymmjx.cn.gov.cn.ymmjx.cn http://www.morning.wkcl.cn.gov.cn.wkcl.cn http://www.morning.kflbf.cn.gov.cn.kflbf.cn http://www.morning.yqsq.cn.gov.cn.yqsq.cn