且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在Tensorflow中使用不带类的预训练模型?

更新时间:2022-04-11 01:07:05

  • ResNet50具有恰好用于此目的的参数include_top-将其设置为False以跳过最后一个完全连接的层. (然后输出长度为2048的特征向量).
  • 减小图像尺寸的***方法是对图像重新采样,例如使用专用功能 tf.image.resample_images .

    • ResNet50 has a parameter include_top exactly for that purpose -- set it to False to skip the last fully connected layer. (It then outputs a feature vector of length 2048).
    • The best way to reduce your image size is to resample the images, e.g. using the dedicated function tf.image.resample_images.

      • 此外,起初我没有注意到您的输入图像只有三个通道,即@Daniel.建议您在GPU上(而不是在使用numpy的主机上)构建3通道灰度图像,以避免使用tf.tile:

      im3 = tf.tile(im, (1, 1, 1, 3))