visdom 显示制作进度条.
先上总进度图
绿色的是训练了多少轮,
蓝色的是每轮训练了多少的进度.
def processbar(self, epoch,epochs,indeximage,totalimages,opts=None):
win = self.cur_win.get("processbar", None)
bili = epoch / epochs * 100
imgbili = indeximage / totalimages * 100
tbl_str = "<div style=\"width: 100%; background-color: #ddd;\" > "\
"<div style=\"text-align: right;margin:5px; padding-right: 20px;height: 40px;line-height: 40px;color: white; width: "+ ('%.2f' % bili) +"%; background-color: #4CAF50;\">"+ str(epoch) +"/"+ str(epochs) +"</div>"\
"<div style=\"text-align: right;margin:5px; padding-right: 20px;height: 40px;line-height: 40px;color: white; width: "+ ('%.2f' % imgbili) +"%; background-color: #2196F3;\">"+ ('%.2f' % imgbili) +"%</div>"\
"</div>"
default_opts = { 'title': 'processbar' }
if opts is not None:
default_opts.update(opts)
if win is not None:
self.vis.text(tbl_str, win=win, opts=default_opts)
else:
self.cur_win["processbar"] = self.vis.text(tbl_str, opts=default_opts)
def main():
processbar(16,50, 33, 560) # 用法.