parent
08235fa991
commit
80bbf62a46
|
@ -58,6 +58,7 @@
|
|||
- [车辆识别](./docs/zh_CN/application/vehicle_fine_grained_classfication.md)
|
||||
- [车辆ReID](./docs/zh_CN/application/vehicle_reid.md)
|
||||
- [logo识别](./docs/zh_CN/application/logo_recognition.md)
|
||||
- [动漫人物识别](./docs/zh_CN/application/cartoon_character_recognition.md)
|
||||
- [向量检索](./deploy/vector_search/README.md)
|
||||
- 模型训练/评估
|
||||
- [图像分类任务](./docs/zh_CN/tutorials/getting_started.md)
|
||||
|
|
|
@ -10,7 +10,7 @@ Now PaddleClas support use VisualDL to visualize the changes of learning rate, l
|
|||
You only need to set the `vdl_dir` field in train config:
|
||||
|
||||
```yaml
|
||||
# confit.txt
|
||||
# config.yaml
|
||||
vdl_dir: "./vdl.log"
|
||||
```
|
||||
|
||||
|
@ -19,7 +19,7 @@ vdl_dir: "./vdl.log"
|
|||
Then normal start training:
|
||||
|
||||
```shell
|
||||
python3 tools/train.py -c config.txt
|
||||
python3 tools/train.py -c config.yaml
|
||||
```
|
||||
|
||||
### Start VisualDL
|
||||
|
|
|
@ -246,7 +246,7 @@ Among them, the `--model` parameter is used to specify the model name, `--pretra
|
|||
|
||||
**Note**:
|
||||
1. If `--output_path=./inference`, then three files will be generated in the folder `inference`, they are `inference.pdiparams`, `inference.pdmodel` and `inference.pdiparams.info`.
|
||||
2. You can specify the `shape` of the model input image by setting the parameter `--img_size`, the default is `224`, which means the shape of input image is `224*224`.
|
||||
2. You can specify the `shape` of the model input image by setting the parameter `--img_size`, the default is `224`, which means the shape of input image is `224*224`. If you want to use `Transformer series models`, such as `DeiT_***_384`, `ViT_***_384`, you need to set `--img_size=384`.
|
||||
|
||||
The above command will generate the model structure file (`inference.pdmodel`) and the model weight file (`inference.pdiparams`), and then the inference engine can be used for inference:
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ VisualDL是飞桨可视化分析工具,以丰富的图表呈现训练参数变
|
|||
在PaddleClas中使用VisualDL,只需在训练配置文件(config文件)添加如下字段:
|
||||
|
||||
```yaml
|
||||
# confit.txt
|
||||
# config.yaml
|
||||
vdl_dir: "./vdl.log"
|
||||
```
|
||||
`vdl_dir` 用于指定VisualDL用于保存log信息的目录。
|
||||
|
@ -18,7 +18,7 @@ vdl_dir: "./vdl.log"
|
|||
然后正常启动训练即可:
|
||||
|
||||
```shell
|
||||
python3 tools/train.py -c config.txt
|
||||
python3 tools/train.py -c config.yaml
|
||||
```
|
||||
|
||||
### 启动VisualDL
|
||||
|
|
|
@ -232,6 +232,10 @@ python3 tools/export_model.py \
|
|||
|
||||
其中,`Global.pretrained_model`用于指定模型文件路径,该路径仍无需包含模型文件后缀名(如[1.3 模型恢复训练](#1.3))。
|
||||
|
||||
**注意**:
|
||||
1. `--output_path`表示输出的inference模型文件夹路径,若`--output_path=./inference`,则会在`inference`文件夹下生成`inference.pdiparams`、`inference.pdmodel`和`inference.pdiparams.info`文件。
|
||||
2. 可以通过设置参数`--img_size`指定模型输入图像的`shape`,默认为`224`,表示图像尺寸为`224*224`,请根据实际情况修改;如果使用`Transformer`系列模型,如`DeiT_***_384`, `ViT_***_384`等,请注意模型的输入数据尺寸,需要设置参数`img_size=384`。
|
||||
|
||||
|
||||
上述命令将生成模型结构文件(`inference.pdmodel`)和模型权重文件(`inference.pdiparams`),然后可以使用预测引擎进行推理:
|
||||
|
||||
|
@ -249,7 +253,7 @@ python3 python/predict_cls.py \
|
|||
-o Global.infer_imgs=../dataset/flowers102/jpg/image_00001.jpg \
|
||||
-o Global.inference_model_dir=../inference/ \
|
||||
-o PostProcess.class_id_map_file=None
|
||||
|
||||
|
||||
|
||||
其中:
|
||||
+ `Global.infer_imgs`:待预测的图片文件路径。
|
||||
|
@ -259,4 +263,6 @@ python3 python/predict_cls.py \
|
|||
+ `Global.enable_mkldnn`:是否启用`MKL-DNN`加速,默认为`False`。注意`enable_mkldnn`与`use_gpu`同时为`True`时,将忽略`enable_mkldnn`,而使用GPU运行。
|
||||
+ `Global.use_fp16`:是否启用`FP16`,默认为`False`。
|
||||
|
||||
**注意**: 如果使用`Transformer`系列模型,如`DeiT_***_384`, `ViT_***_384`等,请注意模型的输入数据尺寸,需要设置参数`resize_short=384`, `resize=384`。
|
||||
|
||||
* 如果你希望提升评测模型速度,使用gpu评测时,建议开启TensorRT加速预测,使用cpu评测时,建议开启MKL-DNN加速预测。
|
||||
|
|
|
@ -160,10 +160,15 @@ class ModelNameError(Exception):
|
|||
|
||||
def print_info():
|
||||
table = PrettyTable(['Series', 'Name'])
|
||||
try:
|
||||
sz = os.get_terminal_size()
|
||||
width = sz.columns - 30 if sz.columns > 50 else 10
|
||||
except OSError:
|
||||
width = 100
|
||||
for series in model_series:
|
||||
names = textwrap.fill(" ".join(model_series[series]), width=100)
|
||||
names = textwrap.fill(" ".join(model_series[series]), width=width)
|
||||
table.add_row([series, names])
|
||||
print('Inference models that Paddle provides are listed as follows:')
|
||||
print('Inference models that PaddleClas provides are listed as follows:')
|
||||
print(table)
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
from . import infer
|
|
@ -0,0 +1,16 @@
|
|||
# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
from .predict import Predictor
|
||||
from .utils import parse_args, create_paddle_predictor, preprocess, postprocess, get_image_list, get_image_list_from_label_file, calc_topk_acc, save_prelabel_results, b64_to_np, np_to_b64
|
Loading…
Reference in New Issue