我正在使用Keras 2.0.0,我想在GPU上训练一个包含大量参数的深度模型.使用太大的图像,我的内存不足(OOM).使用太低的图像,模型的准确性将比可能的更差.因此,我想找到适合我的GPU的最大可能输入尺寸的图像.在model.summary()给定模型和输入数据的情况下,是否有任何计算内存的功能(例如可比较)?
我感谢您的帮助.
我不明白为什么我必须调用fit()/ fit_generator()function两次才能在Keras(版本2.0.0)中微调InceptionV3(或任何其他预训练模型).该文件提出以下建议:
在一组新类上微调InceptionV3
from keras.applications.inception_v3 import InceptionV3
from keras.preprocessing import image
from keras.models import Model
from keras.layers import Dense, GlobalAveragePooling2D
from keras import backend as K
# create the base pre-trained model
base_model = InceptionV3(weights='imagenet', include_top=False)
# add a global spatial average pooling layer
x = base_model.output
x = GlobalAveragePooling2D()(x)
# let's add a fully-connected layer
x = Dense(1024, activation='relu')(x)
# and a logistic layer -- let's say we have 200 classes
predictions = Dense(200, …Run Code Online (Sandbox Code Playgroud)