训练模型时索引
在训练手语翻译的同时,从Github培训了预先开发的代码进行演示。在训练模型时,收到了错误。 这里,
num_of_classes = 7 input_size =(50,50) 火车图像形状:(3670,50,50,1)和 验证图像形状:(367,50,50,1)
火车标签形状:(3670,1008)和验证标签形状:(367,1008)
valueerror:形状(无,1008)和(无,7)不兼容
标签的形状由于输入标签的形状不匹配。
train_images = np.reshape(train_images, (train_images.shape[0],
image_x, image_y, 1))
val_images = np.reshape(val_images,(val_images.shape[0], image_x, image_y, 1))
train_labels = utils.to_categorical(train_labels)#,num_classes = 7)
val_labels = utils.to_categorical(val_labels)#,num_classes = 7)
我
utils.to_categorical(val_labels,num_classes =7)
发现训练标签和验证
indexError:索引1003的范围不超出 尺寸7。
的轴1
如何解决此问题?
While training a sign language translation pre-developed code from GitHub for demonstration. While training a model, received a error.
Here,
num_of_classes = 7
Input_size=(50,50)
The train image shape: (3670, 50, 50, 1) and
Validation image shape : (367, 50, 50, 1)
The train labels shape: (3670, 1008) and Validation labels shape : (367, 1008)
ValueError: shape(None, 1008) and (None,7) are incompatible
I found that training label and validation label shape is mismatching because of input labels shape:
train_images = np.reshape(train_images, (train_images.shape[0],
image_x, image_y, 1))
val_images = np.reshape(val_images,(val_images.shape[0], image_x, image_y, 1))
train_labels = utils.to_categorical(train_labels)#,num_classes = 7)
val_labels = utils.to_categorical(val_labels)#,num_classes = 7)
So, changed to
utils.to_categorical(val_labels,num_classes =7)
But, getting another,
IndexError: index 1003 is out of bounds for
axis 1 with size 7.
How to solve this issue?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论