如何为 3 类 而不是 1000 个自定义 AlexNet?

How to customise AlexNet for 3 classes instead of 1000?

我正在使用来自 here

的 AlexNet

那里的数据有 1000 类,因此它具有相应的权重。我如何让它用于预测我的数据的值,其中有 3 类?

我知道我必须改变权重,但我不知道如何。

您只需设置 num_classes = 3,这将减少模型输出张量和单独定义的占位符 y.

的输出数量 类

调用model = AlexNet(....

时,权重即参数的个数会相应调整

你需要

add one more layer on top of the pre trained network

。这将是您的

output layer

.

第 1000 class 层的输出将作为该层的输入,它会将您的 3 class 作为输出。

之后用您的图像训练这个新网络