在MobileNet导入中遇到argParser错误

时间:2019-11-01 08:35:17

标签: python tensorflow keras

我收到以下错误:

  

错误:需要以下参数:-u /-urls,-o /-output,   运行file.py

第一行是:“从tensorflow.keras.applications导入MobileNetV2”

所有这些导入在juypter笔记本上都可以正常运行

我正在生产我的机器学习模型,从而以h5格式制作具有一些预训练权重的.py文件,并为其加载MobileNet()模型

from tensorflow.keras.applications import MobileNetV2

base_model =MobileNetV2(input_shape=(160,160,3),include_top=False, weights='imagenet')


#importing dense, pooling droupout and making the architecture of the model

x=base_model.output
x=GlobalAveragePooling2D()(x)
x=Dense(1024,activation='relu')(x) #we add dense layers so that the model can learn more complex functions and classify for better results.
x=Dropout(0.2)(x)
x=Dense(512,activation='relu')(x) #dense layer 2
x=Dropout(0.2)(x)
x=Dense(256,activation='relu')(x) #dense layer 3
preds=Dense(2,activation='softmax')(x) #final layer with softmax activation

creating model
model=Model(inputs=base_model.input,outputs=preds)

loading weights
model.load_weights('SixthTraining.h5')

...... rest of code commented..........

running import line in python shell 用法:[-h] -u URLS -o输出

  

:错误:需要以下参数:-u /-urls,-o /-output

running .py file from python interpreter

0 个答案:

没有答案