Releases: geyang/ml-logger
Releases · geyang/ml-logger
Server-side Video Making via `logger.make_video`
ml-logger now supports making videos from a collection of images. See usage bellow for v0.8.83.
def test_make_video():
import scipy.misc
face = scipy.misc.face()
h, w, _ = face.shape
for i in range(10):
logger.save_image(face[i:h - 100 + i, i:w - 100 + i], f"face_{i:04d}.png")
file_list = logger.glob("face_*.png")
# This one makes the video according to ascending order
logger.make_video("face_*", key="videos/face_move_glob.mp4")
logger.make_video("face_*", order='descending', key="videos/face_move_glob_descending.mp4")
# This one makes the video according to the random order given by glob
logger.make_video(file_list, key="videos/face_move_list.mp4")
# this should not reaise an error
path = logger.make_video("no_exist_*.png", key="videos/not_exist.mp4")
assert path is None
v0.8.33
- e7f754e 2021-09-17 | use tempfile to avoid name conflict (HEAD -> master, tag: v0.8.33) [Ge Yang]
def load_torch(self, *keys, path=None, map_location=None, **kwargs):
import torch, tempfile
path = pJoin(*keys, path)
if path.lower().startswith('s3://'):
postfix = os.path.basename(path)
with tempfile.NamedTemporaryFile(suffix=f'.{postfix}') as ntp:
self.download_s3(path[5:], to=ntp.name)
return torch.load(ntp, map_location=map_location, **kwargs)
else:
fn_or_buff = self.load_file(path)
return torch.load(fn_or_buff, map_location=map_location, **kwargs)
Unified Prefix and User Prefix
- remove the debug string from
ML_LOGGER_ROOT
parsing.