Examples shown in Bilibili Live 346623
https://space.bilibili.com/9579763
ART-AIGC-xx
Examples shown in Bilibili Live 346623
License: MIT License
Examples shown in Bilibili Live 346623
https://space.bilibili.com/9579763
ART-AIGC-xx
你好~
我重新找了一些不同的数字(背景是黑色然后字体是白色的)
我将他们都按照你原来的命名方式放到了对应的train,test文件夹里面。名称都是一样的,只有图片内容换了(我的图片也是28*28)。
但是pycharm给出error.
截图上面Train是你的数据集,下面的train2是我的数据集。
不知道为什么只有图片不同,但是最终print出来的dimension是不一样的。数字1, 2 只是加进去标识print的顺序而已。我发现changDim会让array最后多了一个3. 你的是**(28, 28)**, 我的是(28, 28, 3)。 最后会导致我有(1, 28, 28, 1, 3)。
请问怎么样才能用新的数据集去重新train model呢? 这是我的毕业设计内容之一,如果能有你的帮忙就太好了。谢谢!
下面是我用来找不同时候用的code。
def changeDim(img):
img=np.expand_dims(img,axis=2)
img=np.expand_dims(img,axis=0)
return img
######准备数据
num_classes = 11 #类别
batch_size = 120 #批量大小
epochs = 60 #训练次数
#img2 = cv2.imread("5.jpg")
#print(img2.shape)
#img2= changeDim(img2)
#print(img2.shape)
def loadDataset(imgpath, pathtype):
# 准备图像数据
images = loadImages(imgpath[0])
print('1', images.shape)
images = changeDim(images)
print('2', images.shape)
for single in imgpath[1:]:
img = loadImages(single)
img = changeDim(img)
images =np.append(images,img, axis = 0)
# 准备标记
labels = []
pattern = re.compile(pathtype+r"\(\d{1,2})")
for single in imgpath:
label = pattern.findall(single)
labels.append(int(label[0]))
return np.array(images), np.array(labels)
def loadImages(imgpath):
img = misc.imread(imgpath)
if img is None:
return None
img = img.astype('float32')
img/=255
return img
imgfiles = './Train//.jpg'
imgpath = glob.glob(imgfiles)
print(imgpath)
images, labels = loadDataset(imgpath,'Train')
labels = keras.utils.to_categorical(labels, num_classes)
print(images.shape, labels.shape)
imgfiles2 = './Train2//.jpg'
imgpath = glob.glob(imgfiles2)
print(imgpath)
images, labels = loadDataset(imgpath,'Train')
labels = keras.utils.to_categorical(labels, num_classes)
print(images.shape, labels.shape)
imgfiles3 = '5.jpg'
imgpath = glob.glob(imgfiles3)
print(imgpath)
images, labels = loadDataset(imgpath,'Train')
labels = keras.utils.to_categorical(labels, num_classes)
print(images.shape, labels.shape)
MATLAB中k-means里的species变量无法识别如何解决?
图片下载不了
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.