-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Image classification Networks Updating #979
Image classification Networks Updating #979
Conversation
… image_classification
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not a complete review, I concentrated on some things relevant for me.
fluid/image_classification/README.md
Outdated
|
||
# unzip all classes data using unzip.sh | ||
sh unzip.sh | ||
wget paddl_imagenet2012_dataset_url/ImageNet2012_dataset.tar |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please provide the url
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I replace the URL by the official URL and I use download_imagenet2012.sh to get data.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
fluid/image_classification/README.md
Outdated
2. Download training and validation label files from [ImageNet2012 url](https://pan.baidu.com/s/1Y6BCo0nmxsm_FsEqmx2hKQ)(password:```wx99```). Untar it into workspace ```ILSVRC2012/```. The files include | ||
**step-2:** Download training and validation label files | ||
``` | ||
wget paddl_imagenet2012_label_url/ImageNet2012_label.tar |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I update the URL in download_imagenet2012.sh
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
fluid/image_classification/README.md
Outdated
|
||
Models are trained by starting with learning rate ```0.1``` and decaying it by ```0.1``` after each ```30``` epoches, if not special introduced. Available top-1/top-5 validation accuracy on ImageNet 2012 is listed in table. Pretrained models can be downloaded by clicking related model names. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
URLs are all pointing to image_classification directory. Clicking doesn't download them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I cancel the urls without models, and add right urls to networks with trained models
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
fluid/image_classification/eval.py
Outdated
|
||
parser = argparse.ArgumentParser(description=__doc__) | ||
add_arg = functools.partial(add_arguments, argparser=parser) | ||
# yapf: disable | ||
add_arg('batch_size', int, 32, "Minibatch size.") | ||
add_arg('use_gpu', bool, True, "Whether to use GPU or not.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At intel we are optimizing the CPU path performance of PaddlePaddle. Please do not remove the CPU support.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I add yapf 'disable' and 'enable'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
fluid/image_classification/eval.py
Outdated
|
||
parser = argparse.ArgumentParser(description=__doc__) | ||
add_arg = functools.partial(add_arguments, argparser=parser) | ||
# yapf: disable |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removing the block markers # yapf: disable
and # yapf: enable
has made this parameters defining section hard to read. I think it was better previously.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I agree.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I add yapf 'disable' and 'enable'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
fluid/image_classification/eval.py
Outdated
test_info[1].append(acc1 * len(data)) | ||
test_info[2].append(acc5 * len(data)) | ||
cnt += len(data) | ||
print("total_number:", cnt) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Someone running this script wouldn't know what is this total_number
representing. How about a more self-explanatory message?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I delete this line
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
fluid/image_classification/infer.py
Outdated
|
||
parser = argparse.ArgumentParser(description=__doc__) | ||
add_arg = functools.partial(add_arguments, argparser=parser) | ||
# yapf: disable |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as previously.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I fix this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok. can you add yapf: disable/enable here too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
fluid/image_classification/infer.py
Outdated
# model definition | ||
model = models.__dict__[model_name]() | ||
|
||
if model_name in ["GoogleNet"]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as previously
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I update this as you said
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
fluid/image_classification/infer.py
Outdated
|
||
place = fluid.CUDAPlace(0) if args.use_gpu else fluid.CPUPlace() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as previously
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I fix this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks
fluid/image_classification/train.py
Outdated
# model definition | ||
model = models.__dict__[model_name]() | ||
|
||
if model_name in ["GoogleNet"]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as previously
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I update this as you said
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Greate work.
fluid/image_classification/README.md
Outdated
|
||
To start a training task, one can use command line as: | ||
After data preparation, one can start the training by: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove the extra blank between start
and the
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I delete the space
fluid/image_classification/eval.py
Outdated
|
||
parser = argparse.ArgumentParser(description=__doc__) | ||
add_arg = functools.partial(add_arguments, argparser=parser) | ||
# yapf: disable |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I agree.
|
||
return netArg | ||
|
||
def DualPathFactory(self, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The function name should be dual_path_factory
in Google Python style. https://google.github.io/styleguide/pyguide.html
Same as other files and other variables.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I change DualPathFactory
to dual_path_factory
and revise others which have same problem
} | ||
netArg['init_num_filter'] = init_num_filter | ||
netArg['init_filter_size'] = init_filter_size | ||
netArg['init_padding'] = init_padding |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://google.github.io/styleguide/pyguide.html
netArg -> net_arg. Please follow the Google Python style.
…er/models into image_classification
…er/models into image_classification
@sfraczek Hi, I have fix the problems you have metioned. Please review this PR. |
fluid/image_classification/README.md
Outdated
|
||
## Finetuning | ||
|
||
Finetuning is to finetune model weights in a specific task by loading pretrained weights. After initializing ```path_to_pretrain_model``` , one can finetune a model as: | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to give the training results here.
|
||
## 安装 | ||
|
||
在当前目录下运行样例代码需要PadddlePaddle的v0.10.0或以上的版本。如果你的运行环境中的PaddlePaddle低于此版本,请根据[安装文档](http://www.paddlepaddle.org/docs/develop/documentation/zh/build_and_install/pip_install_cn.html)中的说明来更新PaddlePaddle。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PadddlePaddle的v0.10.0 -> PadddlePaddle Fluid v0.13.0
fluid/image_classification/README.md
Outdated
|
||
This model built with paddle fluid is still under active development and is not | ||
the final version. We welcome feedbacks. | ||
Running sample code in this directory requires PaddelPaddle v0.10.0 and later. If the PaddlePaddle on your device is lower than this version, please follow the instructions in [installation document](http://www.paddlepaddle.org/docs/develop/documentation/zh/build_and_install/pip_install_cn.html) and make an update. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PaddelPaddle v0.10.0 -> PaddelPaddle Fluid v0.13.0
|
||
**步骤一:** 从ImageNet官网下载ImageNet-2012的图像数据。训练以及验证数据集会分别被下载到"train" 和 "val" 目录中。 | ||
|
||
**步骤二:** 下载训练与验证集合对应的标签文件。下面两个文件分别包含了训练集合与验证集合中图像的标签: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
告诉用户需要注册ImageNet官网,需要获取key? 提醒下用户下载ImageNet时间较长, 如果用户已经有了数据,按照下面方式组织。
同步改下英文。
|
||
echo "Download imagenet validation data..." | ||
mkdir -p ${valid_folder} | ||
#wget -nd -c ${root_url}/${valid_tar} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove #
echo "Download imagenet label file: val_list.txt & train_list.txt" | ||
label_file=ImageNet_label.tgz | ||
label_url=http://imagenet-data.bj.bcebos.com/${label_file} | ||
#wget -nd -c ${label_url} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove #
--image_shape=3,224,224 \ | ||
--with_mem_opt=True \ | ||
--pretrained_model=${path_to_pretrain_model} | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
给个示例,预测结果长啥样。
--image_shape=3,224,224 \ | ||
--with_mem_opt=True \ | ||
--pretrained_model=${path_to_pretrain_model} | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
给个示例,下载一个已经训练好的模型,这里eval,输出结果长啥样?
…er/models into image_classification
…er/models into image_classification
resolve #978