提交 2a83a209 编写于 作者: W wuzewu

update hub module name

上级 ed3d2276
......@@ -56,7 +56,7 @@ def create_module(args):
"feature_map", inputs=[image], outputs=[feature_map])
hub.create_module(
sign_arr=[sign1, sign2],
module_dir="hub_module_" + args.model,
module_dir=args.model + ".hub_module",
module_info="resources/module_info.yml",
processor=processor.Processor,
assets=assets)
......
......@@ -16,7 +16,7 @@ do
done
script_path=$(cd `dirname $0`; pwd)
module_path=hub_module_${model_name}
module_path=${model_name}.hub_module
if [ -d $script_path/$module_path ]
then
......
python ../../paddlehub/commands/hub.py run hub_module_ResNet50/ --signature classification --config resources/test/test.yml --dataset resources/test/test.csv
python ../../paddlehub/commands/hub.py run ResNet50.hub_module/ --signature classification --config resources/test/test.yml --dataset resources/test/test.csv
name: Resnet50
name: resnet_v2_50_imagenet
type: CV/classification
author: paddlepaddle
author_email: paddle-dev@baidu.com
......
......@@ -5,11 +5,11 @@ import paddlehub as hub
def train():
resnet_module = hub.Module(module_dir="hub_module_ResNet50")
resnet_module = hub.Module(module_dir="ResNet50.hub_module")
input_dict, output_dict, program = resnet_module.context(
sign_name="feature_map", trainable=True)
dataset = hub.dataset.Flowers()
data_reader = hub.ImageClassificationReader(
data_reader = hub.reader.ImageClassificationReader(
image_width=224, image_height=224, dataset=dataset)
with fluid.program_guard(program):
label = fluid.layers.data(name="label", dtype="int64", shape=[1])
......@@ -24,7 +24,7 @@ def train():
feed_list = [img.name, label.name]
task = hub.append_mlp_classifier(
task = hub.create_img_classification_task(
feature=feature_map, label=label, num_classes=dataset.num_labels)
hub.finetune_and_eval(
task, feed_list=feed_list, data_reader=data_reader, config=config)
......
......@@ -35,7 +35,7 @@ def create_module():
# assets
assets = [word_dict_path, label_dict_path, word_rep_dict_path]
# create a module and save as hub_module_lac
# create a module and save as lac.hub_module
sign = hub.create_signature(
name="lexical_analysis",
inputs=[word],
......@@ -43,7 +43,7 @@ def create_module():
for_predict=True)
hub.create_module(
sign_arr=[sign],
module_dir="hub_module_lac",
module_dir="lac.hub_module",
exe=exe,
module_info="resources/module_info.yml",
processor=processor.Processor,
......
......@@ -3,7 +3,7 @@ set -o nounset
set -o errexit
script_path=$(cd `dirname $0`; pwd)
module_path=hub_module_lac
module_path=lac.hub_module
if [ -d $script_path/$module_path ]
then
......
python ../../paddlehub/commands/hub.py run hub_module_lac/ --signature lexical_analysis --config resources/test/test.yml --input_file resources/test/test.txt
python ../../paddlehub/commands/hub.py run lac.hub_module/ --signature lexical_analysis --config resources/test/test.yml --input_file resources/test/test.txt
......@@ -4,7 +4,7 @@ import paddlehub as hub
def infer_with_input_text():
# get lac module
lac = hub.Module(module_dir="hub_module_lac")
lac = hub.Module(module_dir="lac.hub_module")
test_text = ["今天是个好日子", "天气预报说今天要下雨", "下一班地铁马上就要到了"]
......@@ -24,7 +24,7 @@ def infer_with_input_text():
def infer_with_input_file():
# get lac module
lac = hub.Module(module_dir="hub_module_lac")
lac = hub.Module(module_dir="lac.hub_module")
# get the input keys for signature 'lexical_analysis'
data_format = lac.processor.data_format(sign_name='lexical_analysis')
......
......@@ -48,7 +48,7 @@ def create_module():
for_predict=True)
hub.create_module(
sign_arr=[sign],
module_dir="hub_module_senta",
module_dir="senta.hub_module",
exe=exe,
module_info="resources/module_info.yml",
processor=processor.Processor,
......
......@@ -3,7 +3,7 @@ set -o nounset
set -o errexit
script_path=$(cd `dirname $0`; pwd)
module_path=hub_module_senta
module_path=senta.hub_module
if [ -d $script_path/$module_path ]
then
......
python ../../paddlehub/commands/hub.py run hub_module_senta/ --signature sentiment_classify --config resources/test/test.yml --input_file resources/test/test.txt
python ../../paddlehub/commands/hub.py run senta.hub_module/ --signature sentiment_classify --config resources/test/test.yml --input_file resources/test/test.txt
......@@ -4,7 +4,7 @@ import paddlehub as hub
def infer_with_input_text():
# get senta module
senta = hub.Module(module_dir="hub_module_senta")
senta = hub.Module(module_dir="senta.hub_module")
test_text = ["这家餐厅很好吃", "这部电影真的很差劲"]
......@@ -24,7 +24,7 @@ def infer_with_input_text():
def infer_with_input_file():
# get senta module
senta = hub.Module(module_dir="hub_module_senta")
senta = hub.Module(module_dir="senta.hub_module")
# get the input keys for signature 'sentiment_classify'
data_format = senta.processor.data_format(sign_name='sentiment_classify')
......
......@@ -47,7 +47,7 @@ def create_module():
for_predict=True)
hub.create_module(
sign_arr=[sign],
module_dir="hub_module_ssd",
module_dir="ssd_mobilenet_v1_pascal.hub_module",
module_info="resources/module_info.yml",
exe=exe,
processor=processor.Processor,
......
......@@ -3,7 +3,7 @@ set -o nounset
set -o errexit
script_path=$(cd `dirname $0`; pwd)
module_path=hub_module_ssd
module_path=ssd_mobilenet_v1_pascal.hub_module
if [ -d $script_path/$module_path ]
then
......
python ../../paddlehub/commands/hub.py run hub_module_ssd/ --signature object_detection --config resources/test/test.yml --input_file resources/test/test.txt
python ../../paddlehub/commands/hub.py run ssd_mobilenet_v1_pascal.hub_module/ --signature object_detection --config resources/test/test.yml --input_file resources/test/test.txt
......@@ -4,7 +4,7 @@ import paddlehub as hub
def infer_with_input_text():
# get ssd module
ssd = hub.Module(module_dir="hub_module_ssd")
ssd = hub.Module(module_dir="ssd_mobilenet_v1_pascal.hub_module")
test_img_path = os.path.join("resources", "test", "test_img_bird.jpg")
......@@ -23,7 +23,7 @@ def infer_with_input_text():
def infer_with_input_file():
# get ssd module
ssd = hub.Module(module_dir="hub_module_ssd")
ssd = hub.Module(module_dir="ssd_mobilenet_v1_pascal.hub_module")
# get the input keys for signature 'object_detection'
data_format = ssd.processor.data_format(sign_name='object_detection')
......
......@@ -34,7 +34,7 @@ class ImageClassificationDataset(object):
if not os.path.exists(dataset_path):
result, tips, dataset_path = default_downloader.download_file_and_uncompress(
url=url,
save_path=hub.dir.DATA_HOME,
save_path=hub.common.dir.DATA_HOME,
print_progress=True,
replace=True)
if not result:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册