提交 2e03def0 编写于 作者: D dongdaxiang

refine package shoiw list

上级 c4d9418c
...@@ -20,76 +20,43 @@ from collections import OrderedDict ...@@ -20,76 +20,43 @@ from collections import OrderedDict
class ServingModels(object): class ServingModels(object):
def __init__(self): def __init__(self):
self.model_dict = OrderedDict() self.model_dict = OrderedDict()
#senta self.model_dict[
for key in [ "SentimentAnalysis"] = ["senta_bilstm", "senta_bow", "senta_cnn"]
"senta_bilstm", "senta_bow", "senta_cnn", "senta_gru", self.model_dict["SemanticRepresentation"] = ["ernie_base"]
"senta_lstm" self.model_dict["ChineseWordSegmentation"] = ["lac"]
]: self.model_dict["ObjectDetection"] = ["faster_rcnn", "yolov3"]
self.model_dict[ self.model_dict["ImageSegmentation"] = ["unet", "deeplabv3"]
key] = "https://paddle-serving.bj.bcebos.com/paddle_hub_models/text/SentimentAnalysis/" + key + ".tar.gz" self.model_dict["ImageClassification"] = [
#image classification "resnet_v2_50_imagenet", "efficientnetb6_imagenet"
for key in [ ]
"alexnet_imagenet",
"darknet53-imagenet", image_class_url = "https://paddle-serving.bj.bcebos.com/paddle_hub_models/image/ImageClassification/"
"densenet121_imagenet", image_seg_url = "https://paddle-serving.bj.bcebos.com/paddle_hub_models/image/ImageSegmentation/"
"densenet161_imagenet", object_detection_url = "https://paddle-serving.bj.bcebos.com/paddle_hub_models/image/ObjectDetection/"
"densenet169_imagenet", senta_url = "https://paddle-serving.bj.bcebos.com/paddle_hub_models/text/SentimentAnalysis/"
"densenet201_imagenet", semantic_url = "https://paddle-serving.bj.bcebos.com/paddle_hub_models/text/SemanticRepresentation/"
"densenet264_imagenet" wordseg_url = "https://paddle-serving.bj.bcebos.com/paddle_hub_models/text/ChineseWordSegmentation/"
"dpn107_imagenet",
"dpn131_imagenet", self.url_dict = {}
"dpn68_imagenet",
"dpn92_imagenet", def pack_url(model_dict, key, url):
"dpn98_imagenet", for i, value in enumerate(model_dict[key]):
"efficientnetb0_imagenet", self.url_dict[model_dict[key][i]] = url + model_dict[key][
"efficientnetb1_imagenet", i] + ".tar.gz"
"efficientnetb2_imagenet",
"efficientnetb3_imagenet", pack_url(self.model_dict, "SentimentAnalysis", senta_url)
"efficientnetb4_imagenet", pack_url(self.model_dict, "SemanticRepresentation", semantic_url)
"efficientnetb5_imagenet", pack_url(self.model_dict, "ChineseWordSegmentation", wordseg_url)
"efficientnetb6_imagenet", pack_url(self.model_dict, "ObjectDetection", object_detection_url)
"googlenet_imagenet", pack_url(self.model_dict, "ImageSegmentation", image_seg_url)
"inception_v4_imagenet", pack_url(self.model_dict, "ImageClassification", image_class_url)
"inception_v2_imagenet",
"nasnet_imagenet",
"pnasnet_imagenet",
"resnet_v2_101_imagenet",
"resnet_v2_151_imagenet",
"resnet_v2_18_imagenet",
"resnet_v2_34_imagenet",
"resnet_v2_50_imagenet",
"resnext101_32x16d_wsl",
"resnext101_32x32d_wsl",
"resnext101_32x48d_wsl",
"resnext101_32x8d_wsl",
"resnext101_32x4d_imagenet",
"resnext101_64x4d_imagenet",
"resnext101_vd_32x4d_imagenet",
"resnext101_vd_64x4d_imagenet",
"resnext152_64x4d_imagenet",
"resnext152_vd_64x4d_imagenet",
"resnext50_64x4d_imagenet",
"resnext50_vd_32x4d_imagenet",
"resnext50_vd_64x4d_imagenet",
"se_resnext101_32x4d_imagenet",
"se_resnext50_32x4d_imagenet",
"shufflenet_v2_imagenet",
"vgg11_imagenet",
"vgg13_imagenet",
"vgg16_imagenet",
"vgg19_imagenet",
"xception65_imagenet",
"xception71_imagenet",
]:
self.model_dict[
key] = "https://paddle-serving.bj.bcebos.com/paddle_hub_models/image/ImageClassification/" + key + ".tar.gz"
def get_model_list(self): def get_model_list(self):
return (self.model_dict.keys()) return self.model_dict
def download(self, model_name): def download(self, model_name):
if model_name in self.model_dict: if model_name in self.url_dict:
url = self.model_dict[model_name] url = self.url_dict[model_name]
r = os.system('wget ' + url + ' --no-check-certificate') r = os.system('wget ' + url + ' --no-check-certificate')
......
...@@ -20,6 +20,7 @@ Usage: ...@@ -20,6 +20,7 @@ Usage:
""" """
import argparse import argparse
import sys
from .models import ServingModels from .models import ServingModels
...@@ -36,13 +37,18 @@ if __name__ == "__main__": ...@@ -36,13 +37,18 @@ if __name__ == "__main__":
args = parse_args() args = parse_args()
if args.list_model != None: if args.list_model != None:
model_handle = ServingModels() model_handle = ServingModels()
model_names = model_handle.get_model_list() model_dict = model_handle.get_model_list()
for key in model_names: # Task level model list
print(key) # Text Classification, Semantic Representation
# Image Classification, Object Detection, Image Segmentation
for key in model_dict:
print("-----------------------------------------------")
print("{}: {}".format(key, " | ".join(model_dict[key])))
elif args.get_model != "": elif args.get_model != "":
model_handle = ServingModels() model_handle = ServingModels()
model_names = model_handle.get_model_list() model_dict = model_handle.url_dict
if args.get_model not in model_names: if args.get_model not in model_dict:
print( print(
"Your model name does not exist in current model list, stay tuned" "Your model name does not exist in current model list, stay tuned"
) )
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册