Skip to content

Commit

Permalink
[ARMLinux] Change set_model_dir to set_model_from_file in demo files (P…
Browse files Browse the repository at this point in the history
  • Loading branch information
gfwm2013 authored Feb 28, 2020
1 parent b6fda04 commit c1273d0
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions PaddleLite-armlinux-demo/download_models_and_libs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ DETECTION_MODEL_DIR="$(pwd)/object_detection_demo/models/ssd_mobilenet_v1_pascal
CLASSIFICATION_MODEL_DIR="$(pwd)/image_classification_demo/models/mobilenet_v1_for_cpu"
LIBS_DIR="$(pwd)/Paddle-Lite"

CLASSIFICATION_MODEL_URL="https://paddlelite-demo.bj.bcebos.com/models/mobilenet_v1_fp32_224_for_cpu_v2_1_0.tar.gz"
DETECTION_MODEL_URL="https://paddlelite-demo.bj.bcebos.com/models/ssd_mobilenet_v1_pascalvoc_fp32_300_for_cpu_v2_1_0.tar.gz"
LIBS_URL="https://paddlelite-demo.bj.bcebos.com/libs/armlinux/paddle_lite_libs_v2_1_0.tar.gz"
CLASSIFICATION_MODEL_URL="https://paddlelite-demo.bj.bcebos.com/models/mobilenet_v1_fp32_224_for_cpu_v2_3_0.tar.gz"
DETECTION_MODEL_URL="https://paddlelite-demo.bj.bcebos.com/models/ssd_mobilenet_v1_pascalvoc_fp32_300_for_cpu_v2_3_0.tar.gz"
LIBS_URL="https://paddlelite-demo.bj.bcebos.com/libs/armlinux/paddle_lite_libs_v2_3_0.tar.gz"

download_and_uncompress() {
local url="$1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,15 +228,15 @@ int main(int argc, char **argv) {
return -1;
}

std::string model_dir = argv[1];
std::string model_path = argv[1];
std::string label_path = argv[2];

// Load Labels
std::vector<std::string> word_labels = load_labels(label_path);

// Set MobileConfig
paddle::lite_api::MobileConfig config;
config.set_model_dir(model_dir);
config.set_model_from_file(model_path);
config.set_threads(CPU_THREAD_NUM);
config.set_power_mode(CPU_POWER_MODE);

Expand Down
2 changes: 1 addition & 1 deletion PaddleLite-armlinux-demo/image_classification_demo/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ cmake -DPADDLE_LITE_DIR=${PADDLE_LITE_DIR} -DTARGET_ARCH_ABI=${TARGET_ARCH_ABI}
make

#run
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${PADDLE_LITE_DIR}/libs/${TARGET_ARCH_ABI} ./image_classification_demo ../models/mobilenet_v1_for_cpu ../labels/synset_words.txt ../images/tabby_cat.jpg ./result.jpg
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${PADDLE_LITE_DIR}/libs/${TARGET_ARCH_ABI} ./image_classification_demo ../models/mobilenet_v1_for_cpu/model.nb ../labels/synset_words.txt ../images/tabby_cat.jpg ./result.jpg
Original file line number Diff line number Diff line change
Expand Up @@ -239,13 +239,13 @@ int main(int argc, char **argv) {
return -1;
}

std::string model_dir = argv[1];
std::string model_path = argv[1];
std::string label_path = argv[2];

std::vector<std::string> word_labels = load_labels(label_path);

paddle::lite_api::MobileConfig config;
config.set_model_dir(model_dir);
config.set_model_from_file(model_path);
config.set_threads(CPU_THREAD_NUM);
config.set_power_mode(CPU_POWER_MODE);

Expand Down
2 changes: 1 addition & 1 deletion PaddleLite-armlinux-demo/object_detection_demo/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ cmake -DPADDLE_LITE_DIR=${PADDLE_LITE_DIR} -DTARGET_ARCH_ABI=${TARGET_ARCH_ABI}
make

#run
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${PADDLE_LITE_DIR}/libs/${TARGET_ARCH_ABI} ./object_detection_demo ../models/ssd_mobilenet_v1_pascalvoc_for_cpu ../labels/pascalvoc_label_list ../images/dog.jpg ./result.jpg
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${PADDLE_LITE_DIR}/libs/${TARGET_ARCH_ABI} ./object_detection_demo ../models/ssd_mobilenet_v1_pascalvoc_for_cpu/model.nb ../labels/pascalvoc_label_list ../images/dog.jpg ./result.jpg

0 comments on commit c1273d0

Please sign in to comment.