-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #27 from kaseris/dev
Merge to main
- Loading branch information
Showing
9 changed files
with
124 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
data/skeletons/* | ||
.vscode/ | ||
runs/* | ||
|
||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
|
||
from abc import ABC, abstractmethod | ||
|
||
class BaseLogger(ABC): | ||
@abstractmethod | ||
def add_scalar(self): | ||
pass | ||
|
||
@abstractmethod | ||
def add_scalars(self): | ||
pass | ||
|
||
@abstractmethod | ||
def add_histogram(self): | ||
pass | ||
|
||
@abstractmethod | ||
def add_image(self): | ||
pass | ||
|
||
@abstractmethod | ||
def close(self): | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
from torch.utils.tensorboard import SummaryWriter | ||
from skelcast.logger.base import BaseLogger | ||
|
||
|
||
class TensorboardLogger(BaseLogger): | ||
def __init__(self, log_dir): | ||
super().__init__() | ||
self.writer = SummaryWriter(log_dir) | ||
|
||
def add_scalar(self, tag, scalar_value, global_step=None, walltime=None): | ||
self.writer.add_scalar(tag, scalar_value, global_step, walltime) | ||
|
||
def add_scalars(self, main_tag, tag_scalar_dict, global_step=None, walltime=None): | ||
self.writer.add_scalars(main_tag, tag_scalar_dict, global_step, walltime) | ||
|
||
def add_histogram(self, tag, values, global_step=None, bins='tensorflow', walltime=None, max_bins=None): | ||
self.writer.add_histogram(tag, values, global_step, bins, walltime, max_bins) | ||
|
||
def add_image(self, tag, img_tensor, global_step=None, walltime=None, dataformats='CHW'): | ||
self.writer.add_image(tag, img_tensor, global_step, walltime, dataformats) | ||
|
||
# Implement other methods from SummaryWriter as needed | ||
|
||
def close(self): | ||
self.writer.close() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters