-
Notifications
You must be signed in to change notification settings - Fork 208
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
[Feature]: support image visualization for tensorboard and wandb #15
Conversation
@@ -23,4 +23,5 @@ | |||
dict(type='CenterCrop', size=224), | |||
dict(type='ToTensor'), | |||
dict(type='Normalize', **img_norm_cfg), | |||
dict(type='Collect', keys=['img', 'gt_labels']) |
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.
has nothing to do with this pr, fix previous bug, please refer to: #6
org = (text_baseline + text_size[1], | ||
text_baseline + text_size[1] + cur_height) | ||
|
||
# support chinese text |
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.
support chinese font
|
||
filename = img_metas[i]['ori_filename'] | ||
self.writer.add_image( | ||
f'{vis_key}/{filename}', |
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.
add group_name vis_key
easycv/core/visualization/image.py
Outdated
|
||
|
||
def download_font(save_path=None): | ||
url_path = 'http://pai-vision-data-hz.oss-accelerate.aliyuncs.com/EasyCV/pkgs/simhei.ttf' |
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.
add this font to git and auto package it into our python whl
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.
put simhei.ttf to resource dir, and support package to whl and zip
easycv/hooks/tensorboard.py
Outdated
img, torch.Tensor | ||
), 'Only support np.ndarray and torch.Tensor type!' | ||
|
||
filename = img_metas[i]['ori_filename'] |
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.
is filename sufficient for visualization? img_metas is not straightforward
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.
add doc, img_metas is optional
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.
if imag_metas does not exsits in vis_result, line 29 will throw exception
@@ -168,7 +175,8 @@ | |||
interval=100, | |||
hooks=[ | |||
dict(type='TextLoggerHook'), | |||
dict(type='TensorboardLoggerHook') | |||
dict(type='TensorboardLoggerHookV2'), | |||
# dict(type='WandbLoggerHookV2'), |
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.
wandb config example should be added in another file or using comment format
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.
add comment
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.
wandb initialization config is missing
pil_image = PILImage.fromarray(img, mode='RGB') | ||
filename = img_metas[i].get( | ||
'ori_filename', | ||
'image') if img_metas is not None else 'image' |
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_${i}
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.
done
Tensorboard visulization is as follows:
Wandb visulization is as follows:
The step interval shown in the figure is the number of steps of N epoch, N is the eval intervel.
Usage: