diff --git a/docs/images/tensorboard_fruit.jpg b/docs/images/tensorboard_fruit.jpg deleted file mode 100644 index 44a955fafffb4ab03d911818e20e6f72499f2f4f..0000000000000000000000000000000000000000 Binary files a/docs/images/tensorboard_fruit.jpg and /dev/null differ diff --git a/docs/images/visualdl_fruit.jpg b/docs/images/visualdl_fruit.jpg new file mode 100644 index 0000000000000000000000000000000000000000..4079a0a33a5ff94502bbb060021d0899956c2a3c Binary files /dev/null and b/docs/images/visualdl_fruit.jpg differ diff --git a/docs/tutorials/GETTING_STARTED.md b/docs/tutorials/GETTING_STARTED.md index 1b509df0ed90c116357435965cef29657dedbf82..69bd1a7bb17df3e6b61381f963096fcde1b7e3ad 100644 --- a/docs/tutorials/GETTING_STARTED.md +++ b/docs/tutorials/GETTING_STARTED.md @@ -41,8 +41,8 @@ list below can be viewed by `--help` | --draw_threshold | infer | Threshold to reserve the result for visualization | 0.5 | `--draw_threshold 0.7` | | --infer_dir | infer | Directory for images to perform inference on | None | | | --infer_img | infer | Image path | None | higher priority over --infer_dir | -| --use_tb | train/infer | Whether to record the data with [tb-paddle](https://github.com/linshuliang/tb-paddle), so as to display in Tensorboard | False | | -| --tb\_log_dir | train/infer | tb-paddle logging directory for image | train:`tb_log_dir/scalar` infer: `tb_log_dir/image` | | +| --use_vdl | train/infer | Whether to record the data with [VisualDL](https://github.com/paddlepaddle/visualdl), so as to display in VisualDL | False | | +| --vdl\_log_dir | train/infer | VisualDL logging directory for image | train:`vdl_log_dir/scalar` infer: `vdl_log_dir/image` | | ## Examples @@ -163,7 +163,7 @@ moment, but it is a planned feature --output_dir=infer_output/ \ --draw_threshold=0.5 \ -o weights=output/faster_rcnn_r50_1x/model_final \ - --use_tb=Ture + --use_vdl=Ture ``` `--draw_threshold` is an optional argument. Default is 0.5. diff --git a/docs/tutorials/GETTING_STARTED_cn.md b/docs/tutorials/GETTING_STARTED_cn.md index 7f26016545d499f18df55dd5f81579cdd459302a..0bc7a445a88d9a921f7673ca4ab62ecdba100de9 100644 --- a/docs/tutorials/GETTING_STARTED_cn.md +++ b/docs/tutorials/GETTING_STARTED_cn.md @@ -38,8 +38,8 @@ python tools/infer.py -c configs/faster_rcnn_r50_1x.yml --infer_img=demo/0000005 | --draw_threshold | infer | 可视化时分数阈值 | 0.5 | `--draw_threshold 0.7` | | --infer_dir | infer | 用于预测的图片文件夹路径 | None | | | --infer_img | infer | 用于预测的图片路径 | None | 相较于`--infer_dir`具有更高优先级 | -| --use_tb | train/infer | 是否使用[tb-paddle](https://github.com/linshuliang/tb-paddle)记录数据,进而在TensorBoard中显示 | False | | -| --tb\_log_dir | train/infer | 指定 tb-paddle 记录数据的存储路径 | train:`tb_log_dir/scalar` infer: `tb_log_dir/image` | | +| --use_vdl | train/infer | 是否使用[VisualDL](https://github.com/paddlepaddle/visualdl)记录数据,进而在VisualDL面板中显示 | False | | +| --vdl\_log_dir | train/infer | 指定 VisualDL 记录数据的存储路径 | train:`vdl_log_dir/scalar` infer: `vdl_log_dir/image` | | ## 使用示例 diff --git a/docs/tutorials/QUICK_STARTED.md b/docs/tutorials/QUICK_STARTED.md index e40d6869e7e7a8e6deaeadc15efadd0c08165d38..2f8a64cc03746aa7f947393a351edd5e523753f9 100644 --- a/docs/tutorials/QUICK_STARTED.md +++ b/docs/tutorials/QUICK_STARTED.md @@ -22,20 +22,20 @@ Training: ```bash python -u tools/train.py -c configs/yolov3_mobilenet_v1_fruit.yml \ - --use_tb=True \ - --tb_log_dir=tb_fruit_dir/scalar \ + --use_vdl=True \ + --vdl_log_dir=vdl_fruit_dir/scalar \ --eval ``` -Use `yolov3_mobilenet_v1` to fine-tune the model from COCO dataset. Meanwhile, loss and mAP can be observed on tensorboard. +Use `yolov3_mobilenet_v1` to fine-tune the model from COCO dataset. Meanwhile, loss and mAP can be observed on VisualDL. ```bash -tensorboard --logdir tb_fruit_dir/scalar/ --host --port +visualdl --logdir vdl_fruit_dir/scalar/ --host --port ``` -Result on tensorboard is shown below: +Result on VisualDL is shown below: -![tensorboard_fruit.jpg](../images/tensorboard_fruit.jpg) +![visualdl_fruit.jpg](../images/visualdl_fruit.jpg) Model can be downloaded [here](https://paddlemodels.bj.bcebos.com/object_detection/yolov3_mobilenet_v1_fruit.tar) diff --git a/docs/tutorials/QUICK_STARTED_cn.md b/docs/tutorials/QUICK_STARTED_cn.md index 407cb7f0b22626a5af543776e67f1e7742ae49f5..607f0e13631aee274bc235507c730f19d22cfa5d 100644 --- a/docs/tutorials/QUICK_STARTED_cn.md +++ b/docs/tutorials/QUICK_STARTED_cn.md @@ -24,21 +24,21 @@ python dataset/fruit/download_fruit.py ```bash python -u tools/train.py -c configs/yolov3_mobilenet_v1_fruit.yml \ - --use_tb=True \ - --tb_log_dir=tb_fruit_dir/scalar \ + --use_vdl=True \ + --vdl_log_dir=vdl_fruit_dir/scalar \ --eval ``` -训练使用`yolov3_mobilenet_v1`基于COCO数据集训练好的模型进行finetune。训练期间可以通过tensorboard实时观察loss和精度值,启动命令如下: +训练使用`yolov3_mobilenet_v1`基于COCO数据集训练好的模型进行finetune。训练期间可以通过VisualDL实时观察loss和精度值,启动命令如下: ```bash -tensorboard --logdir tb_fruit_dir/scalar/ --host --port +visualdl --logdir vdl_fruit_dir/scalar/ --host --port ``` -tensorboard结果显示如下: +VisualDL结果显示如下: -![](../images/tensorboard_fruit.jpg) +![](../images/visualdl_fruit.jpg) 训练模型[下载链接](https://paddlemodels.bj.bcebos.com/object_detection/yolov3_mobilenet_v1_fruit.tar) diff --git a/requirements.txt b/requirements.txt index bbdf58ec9b8c958aa61f93bf26345616972917ca..170c8a3b02587483c574a831b5f248ffe926ee6b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,7 +1,6 @@ tqdm typeguard ; python_version >= '3.4' -tb-paddle -tensorboard >= 1.15 +visualdl>=2.0.0b opencv-python PyYAML shapely diff --git a/slim/prune/prune.py b/slim/prune/prune.py index 2b7815059ea240f1aaaec645deaea116f37d386e..f6b219b36b0229c920d48c2e8bde6de8a2fd1682 100644 --- a/slim/prune/prune.py +++ b/slim/prune/prune.py @@ -244,12 +244,12 @@ def main(): time_stat = deque(maxlen=cfg.log_smooth_window) best_box_ap_list = [0.0, 0] #[map, iter] - # use tb-paddle to log data - if FLAGS.use_tb: - from tb_paddle import SummaryWriter - tb_writer = SummaryWriter(FLAGS.tb_log_dir) - tb_loss_step = 0 - tb_mAP_step = 0 + # use VisualDL to log data + if FLAGS.use_vdl: + from visualdl import LogWriter + vdl_writer = LogWriter(FLAGS.vdl_log_dir) + vdl_loss_step = 0 + vdl_mAP_step = 0 if FLAGS.eval: resolution = None @@ -286,12 +286,12 @@ def main(): outs = exe.run(compiled_train_prog, fetch_list=train_values) stats = {k: np.array(v).mean() for k, v in zip(train_keys, outs[:-1])} - # use tb-paddle to log loss - if FLAGS.use_tb: + # use VisualDL to log loss + if FLAGS.use_vdl: if it % cfg.log_iter == 0: for loss_name, loss_value in stats.items(): - tb_writer.add_scalar(loss_name, loss_value, tb_loss_step) - tb_loss_step += 1 + vdl_writer.add_scalar(loss_name, loss_value, vdl_loss_step) + vdl_loss_step += 1 train_stats.update(stats) logs = train_stats.log() @@ -329,10 +329,10 @@ def main(): map_type, dataset=dataset) - # use tb_paddle to log mAP - if FLAGS.use_tb: - tb_writer.add_scalar("mAP", box_ap_stats[0], tb_mAP_step) - tb_mAP_step += 1 + # use VisualDL to log mAP + if FLAGS.use_vdl: + vdl_writer.add_scalar("mAP", box_ap_stats[0], vdl_mAP_step) + vdl_mAP_step += 1 if box_ap_stats[0] > best_box_ap_list[0]: best_box_ap_list[0] = box_ap_stats[0] @@ -374,15 +374,15 @@ if __name__ == '__main__': type=str, help="Evaluation directory, default is current directory.") parser.add_argument( - "--use_tb", + "--use_vdl", type=bool, default=False, - help="whether to record the data to Tensorboard.") + help="whether to record the data to VisualDL.") parser.add_argument( - '--tb_log_dir', + '--vdl_log_dir', type=str, - default="tb_log_dir/scalar", - help='Tensorboard logging directory for scalar.') + default="vdl_log_dir/scalar", + help='VisualDL logging directory for scalar.') parser.add_argument( "-p", diff --git a/tools/infer.py b/tools/infer.py index f889eff816fe0e151fe7bf771ad90190a103655a..2ffb0e8fdce9ff914780c6f7f6001a82e905064e 100644 --- a/tools/infer.py +++ b/tools/infer.py @@ -158,12 +158,12 @@ def main(): callable(model.is_bbox_normalized): is_bbox_normalized = model.is_bbox_normalized() - # use tb-paddle to log image - if FLAGS.use_tb: - from tb_paddle import SummaryWriter - tb_writer = SummaryWriter(FLAGS.tb_log_dir) - tb_image_step = 0 - tb_image_frame = 0 # each frame can display ten pictures at most. + # use VisualDL to log image + if FLAGS.use_vdl: + from visualdl import LogWriter + vdl_writer = LogWriter(FLAGS.vdl_log_dir) + vdl_image_step = 0 + vdl_image_frame = 0 # each frame can display ten pictures at most. imid2path = dataset.get_imid2path() for iter_id, data in enumerate(loader()): @@ -191,32 +191,27 @@ def main(): image_path = imid2path[int(im_id)] image = Image.open(image_path).convert('RGB') - # use tb-paddle to log original image - if FLAGS.use_tb: + # use VisualDL to log original image + if FLAGS.use_vdl: original_image_np = np.array(image) - tb_writer.add_image( - "original/frame_{}".format(tb_image_frame), - original_image_np, - tb_image_step, - dataformats='HWC') + vdl_writer.add_image( + "original/frame_{}".format(vdl_image_frame), + original_image_np, vdl_image_step) image = visualize_results(image, int(im_id), catid2name, FLAGS.draw_threshold, bbox_results, mask_results) - # use tb-paddle to log image with bbox - if FLAGS.use_tb: + # use VisualDL to log image with bbox + if FLAGS.use_vdl: infer_image_np = np.array(image) - tb_writer.add_image( - "bbox/frame_{}".format(tb_image_frame), - infer_image_np, - tb_image_step, - dataformats='HWC') - tb_image_step += 1 - if tb_image_step % 10 == 0: - tb_image_step = 0 - tb_image_frame += 1 + vdl_writer.add_image("bbox/frame_{}".format(vdl_image_frame), + infer_image_np, vdl_image_step) + vdl_image_step += 1 + if vdl_image_step % 10 == 0: + vdl_image_step = 0 + vdl_image_frame += 1 save_name = get_save_image_name(FLAGS.output_dir, image_path) logger.info("Detection bbox results save in {}".format(save_name)) @@ -246,14 +241,14 @@ if __name__ == '__main__': default=0.5, help="Threshold to reserve the result for visualization.") parser.add_argument( - "--use_tb", + "--use_vdl", type=bool, default=False, - help="whether to record the data to Tensorboard.") + help="whether to record the data to VisualDL.") parser.add_argument( - '--tb_log_dir', + '--vdl_log_dir', type=str, - default="tb_log_dir/image", - help='Tensorboard logging directory for image.') + default="vdl_log_dir/image", + help='VisualDL logging directory for image.') FLAGS = parser.parse_args() main() diff --git a/tools/train.py b/tools/train.py index c6464abb90228f13c53f2d37d5c29ff1689a6be5..20ae45f0cb9ae4f3be7b85e675b9cfbde1ac6c8d 100644 --- a/tools/train.py +++ b/tools/train.py @@ -222,12 +222,12 @@ def main(): time_stat = deque(maxlen=cfg.log_smooth_window) best_box_ap_list = [0.0, 0] #[map, iter] - # use tb-paddle to log data - if FLAGS.use_tb: - from tb_paddle import SummaryWriter - tb_writer = SummaryWriter(FLAGS.tb_log_dir) - tb_loss_step = 0 - tb_mAP_step = 0 + # use VisualDL to log data + if FLAGS.use_vdl: + from visualdl import LogWriter + vdl_writer = LogWriter(FLAGS.vdl_log_dir) + vdl_loss_step = 0 + vdl_mAP_step = 0 for it in range(start_iter, cfg.max_iters): start_time = end_time @@ -239,12 +239,12 @@ def main(): outs = exe.run(compiled_train_prog, fetch_list=train_values) stats = {k: np.array(v).mean() for k, v in zip(train_keys, outs[:-1])} - # use tb-paddle to log loss - if FLAGS.use_tb: + # use vdl-paddle to log loss + if FLAGS.use_vdl: if it % cfg.log_iter == 0: for loss_name, loss_value in stats.items(): - tb_writer.add_scalar(loss_name, loss_value, tb_loss_step) - tb_loss_step += 1 + vdl_writer.add_scalar(loss_name, loss_value, vdl_loss_step) + vdl_loss_step += 1 train_stats.update(stats) logs = train_stats.log() @@ -287,10 +287,10 @@ def main(): is_bbox_normalized, FLAGS.output_eval, map_type, cfg['EvalReader']['dataset']) - # use tb_paddle to log mAP - if FLAGS.use_tb: - tb_writer.add_scalar("mAP", box_ap_stats[0], tb_mAP_step) - tb_mAP_step += 1 + # use vdl_paddle to log mAP + if FLAGS.use_vdl: + vdl_writer.add_scalar("mAP", box_ap_stats[0], vdl_mAP_step) + vdl_mAP_step += 1 if box_ap_stats[0] > best_box_ap_list[0]: best_box_ap_list[0] = box_ap_stats[0] @@ -335,15 +335,15 @@ if __name__ == '__main__': type=str, help="Evaluation directory, default is current directory.") parser.add_argument( - "--use_tb", + "--use_vdl", type=bool, default=False, - help="whether to record the data to Tensorboard.") + help="whether to record the data to VisualDL.") parser.add_argument( - '--tb_log_dir', + '--vdl_log_dir', type=str, - default="tb_log_dir/scalar", - help='Tensorboard logging directory for scalar.') + default="vdl_log_dir/scalar", + help='VisualDL logging directory for scalar.') parser.add_argument( "--enable_ce", type=bool,