Skip to content

Commit

Permalink
add console_scripts for plsc-train, plsc-eval, plsc-export (PaddlePad…
Browse files Browse the repository at this point in the history
  • Loading branch information
GuoxiaWang authored Oct 18, 2022
1 parent 7321b10 commit 6dd3c2a
Show file tree
Hide file tree
Showing 9 changed files with 82 additions and 33 deletions.
13 changes: 13 additions & 0 deletions plsc/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Copyright (c) 2022 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.
13 changes: 13 additions & 0 deletions plsc/engine/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Copyright (c) 2022 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.
13 changes: 13 additions & 0 deletions plsc/utils/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Copyright (c) 2022 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.
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ opencv-python
pillow
numpy
easydict
scikit-image
scipy
sklearn
requests
prettytable
tqdm
Pillow
visualdl
scikit-learn==0.23.2
opencv-python==4.4.0.46
Expand Down
7 changes: 7 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,11 @@
download_url='https://github.com/PaddlePaddle/PLSC.git',
packages=find_packages(),
zip_safe=False,
entry_points={
"console_scripts": [
"plsc-train = tools.train:main",
"plsc-eval = tools.eval:main",
"plsc-export = tools.export:main",
],
},
install_requires=requirements, )
21 changes: 11 additions & 10 deletions tools/eval.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,23 @@
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import sys
__dir__ = os.path.dirname(os.path.abspath(__file__))
sys.path.append(os.path.abspath(os.path.join(__dir__, '../')))

from plsc.utils import config
from plsc.engine.engine import Engine

import paddle
paddle.disable_static()

if __name__ == "__main__":
args = config.parse_args()
config = config.get_config(
from plsc.utils import config as cfg_util
from plsc.engine.engine import Engine


def main():
args = cfg_util.parse_args()
config = cfg_util.get_config(
args.config, overrides=args.override, show=False)
config.profiler_options = args.profiler_options
engine = Engine(config, mode="eval")
ret = engine.eval()
print(ret)


if __name__ == "__main__":
main()
21 changes: 11 additions & 10 deletions tools/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,22 @@
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import sys
__dir__ = os.path.dirname(os.path.abspath(__file__))
sys.path.append(os.path.abspath(os.path.join(__dir__, '../')))

from plsc.utils import config
from plsc.engine.engine import Engine

import paddle
paddle.disable_static()

if __name__ == "__main__":
args = config.parse_args()
config = config.get_config(
from plsc.utils import config as cfg_util
from plsc.engine.engine import Engine


def main():
args = cfg_util.parse_args()
config = cfg_util.get_config(
args.config, overrides=args.override, show=False)
config.profiler_options = args.profiler_options
engine = Engine(config, mode="export")
engine.export()


if __name__ == "__main__":
main()
21 changes: 11 additions & 10 deletions tools/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,22 @@
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import sys
__dir__ = os.path.dirname(os.path.abspath(__file__))
sys.path.append(os.path.abspath(os.path.join(__dir__, '../')))

from plsc.utils import config
from plsc.engine.engine import Engine

import paddle
paddle.disable_static()

if __name__ == "__main__":
args = config.parse_args()
config = config.get_config(
from plsc.utils import config as cfg_util
from plsc.engine.engine import Engine


def main():
args = cfg_util.parse_args()
config = cfg_util.get_config(
args.config, overrides=args.override, show=False)
config.profiler_options = args.profiler_options
engine = Engine(config, mode="train")
engine.train()


if __name__ == "__main__":
main()
4 changes: 2 additions & 2 deletions tutorials/get_started/installation.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
## Install PaddlePaddle from whl Package
```
# [optional] modify cuda version, e.g. post112 to post116
# require python >= 3.7
# require python==3.7, paddlepaddle-gpu==2.4.x
python -m pip install paddlepaddle-gpu==2.4.0.post112 -f https://www.paddlepaddle.org.cn/whl/linux/mkl/avx/stable.html
```

Expand Down Expand Up @@ -31,6 +31,6 @@ pip install output/opt/paddle/share/wheels/paddlepaddle_gpu-0.0.0-cp37-cp37m-lin
git clone https://github.com/PaddlePaddle/PLSC.git

cd /path/to/PLSC/

# [optional] pip install -r requirements.txt
python setup.py develop
```

0 comments on commit 6dd3c2a

Please sign in to comment.