图像分类任务

人工智能 其他 案例ID:213895
明年
1 年经验· 211高校人工智能研究生
微信扫码沟通,客服可协助直接对接工程师;如当前档期不合,也可继续推荐相似案例作者。

案例介绍

# 下面是使用tensorflow实现图像分类的预测代码(部分)
# create model
feature = resnet50(num_classes=num_classes, include_top=False)
feature.trainable = False
model = tf.keras.Sequential([feature,
tf.keras.layers.GlobalAvgPool2D(),
tf.keras.layers.Dropout(rate=0.5),
tf.keras.layers.Dense(1024, activation="relu"),
tf.keras.layers.Dropout(rate=0.5),
tf.keras.layers.Dense(num_classes),
tf.keras.layers.Softmax()])

# load weights
weights_path = './save_weights/resNet_50.ckpt'
assert len(glob.glob(weights_path+"*")), "cannot find {}".format(weights_path)
model.load_weights(weights_path)

# prediction
result = np.squeeze(model.predict(img))

图像分类任务

人工智能 · 其他 案例ID:213895
联系该工程师
微信扫码,建群沟通
作者: 明年 - 1年经验- 211高校人工智能研究生

案例介绍

# 下面是使用tensorflow实现图像分类的预测代码(部分)
# create model
feature = resnet50(num_classes=num_classes, include_top=False)
feature.trainable = False
model = tf.keras.Sequential([feature,
tf.keras.layers.GlobalAvgPool2D(),
tf.keras.layers.Dropout(rate=0.5),
tf.keras.layers.Dense(1024, activation="relu"),
tf.keras.layers.Dropout(rate=0.5),
tf.keras.layers.Dense(num_classes),
tf.keras.layers.Softmax()])

# load weights
weights_path = './save_weights/resNet_50.ckpt'
assert len(glob.glob(weights_path+"*")), "cannot find {}".format(weights_path)
model.load_weights(weights_path)

# prediction
result = np.squeeze(model.predict(img))

相似案例推荐

发布任务

企业点击发布任务,工程师会在任务下报名,招聘专员也会在 1 小时内与您联系确认。

1小时精推人才

需求方专属客服,免费梳理匹配

需求方客服微信二维码
扫码加微信 · 客服人工对接
更多案例
微信沟通 客服 看中这位工程师了?客服帮你 1 小时对接沟通 → ×