diff --git a/README.md b/README.md index 1f00b6b..492dfa5 100644 --- a/README.md +++ b/README.md @@ -66,6 +66,10 @@ Before you start trainer, please use command as follows to open visdom server. ```shell script python -m visdom.server ``` +Or you can run script/visdom_open.py +```shell +python script/visdom_open.py +``` Then you can see the charts in browser in special port. ---- @@ -74,6 +78,18 @@ Then you can see the charts in browser in special port. - inherit implement TrainBase - change config.yml file and run. +#### A easy way to create your method +run script create_algorithm.py as following: +```shell +python create_algorithm.py ${method_name} +``` +You can assign the method name by command or in create_algorithm.py + +After running create_algorithm.py, you should get a new python file with your method name in "torchcmh/training/". +And you should also get a directory with your method name in "torchcmh/models". + +Finish your algorithm and run it. + #### some function in TrainBase - loss variable \ In your method, some variables you need to store and check, such as loss and acc. diff --git a/UpdateLog.md b/UpdateLog.md index 82b73de..d331f9a 100644 --- a/UpdateLog.md +++ b/UpdateLog.md @@ -1,7 +1,12 @@ + + ## 2021.5.11 +### version : 0.3.1 ### new features: - 根据模板生成算法所需的算法和模型文件 -- 将vidsom的配置和启动加载到run命令中,不需要单独使用命令启动 -### fixed bug: +- 添加visdom启动脚本 +- 更新README介绍 +### fix bug: - 部分算法代码的缩进问题 +- plotter.py 创建Visdom对象时默认端口8097,并在调用接口添加该参数 diff --git a/script/default_config.yml b/script/default_config.yml index 93a966a..1ab5028 100644 --- a/script/default_config.yml +++ b/script/default_config.yml @@ -10,11 +10,11 @@ datasetPath: Mirflickr25k: img_dir: I:\dataset\mirflickr25k\mirflickr NUS WIDE: - img_dir: + img_dir: I:\dataset\nuswide\ COCO2014: - img_dir: + img_dir: I:\dataset\coco2014\ IAPR TC-12: - img_dir: + img_dir: I:\dataset\iaprtc-12\ dataPreprocess: img: diff --git a/script/visdom_open.py b/script/visdom_open.py new file mode 100644 index 0000000..ed76984 --- /dev/null +++ b/script/visdom_open.py @@ -0,0 +1,12 @@ +# coding: utf-8 +# author: Godder +# Date: 2021/5/11 +# Github: https://github.com/WangGodder +import os +import sys + +if __name__ == '__main__': + port = 8097 + if len(sys.argv) > 1: + port = int(sys.argv[1]) + result = os.system("python -m visdom.server -port %i" % port) \ No newline at end of file diff --git a/torchcmh/utils/plotter.py b/torchcmh/utils/plotter.py index 1e721aa..2bae047 100644 --- a/torchcmh/utils/plotter.py +++ b/torchcmh/utils/plotter.py @@ -8,8 +8,8 @@ class VisdomLinePlotter(object): """Plots to Visdom""" - def __init__(self, env_name='plotter'): - self.viz = Visdom() + def __init__(self, env_name='plotter', port=8097): + self.viz = Visdom(port=port) self.env = env_name self.plots = {} self.epoch = 0 @@ -33,6 +33,7 @@ def next_epoch(self): def reset_epoch(self): self.epoch = 0 + def get_plotter(env_name: str): return VisdomLinePlotter(env_name)