def __init__(self,
                 model,
                 save_dir="",
                 *,
                 save_to_disk=None,
                 **checkpointables):
        is_main_process = comm.is_main_process()
        super().__init__(
            model,
            save_dir,
            save_to_disk=is_main_process
            if save_to_disk is None else save_to_disk,
            **checkpointables,
        )
        if hasattr(self, "path_manager"):
            self.path_manager = PathManager
        else:
            # This could only happen for open source
            # TODO remove after upgrading fvcore version
            from iopath.common.file_io import g_pathmgr

            for handler in PathManager._path_handlers.values():
                try:
                    g_pathmgr.register_handler(handler)
                except KeyError:
                    pass
示例#2
0
 def register_handler(handler) -> None:
     if IOPathManager:
         return IOPathManager.register_handler(handler=handler)
示例#3
0
import logging
import os
import shutil
from typing import List, Optional

logger = logging.getLogger(__file__)

try:
    from iopath.common.file_io import g_pathmgr as IOPathManager

    try:
        # [FB only - for now] AWS PathHandler for PathManager
        from .fb_pathhandlers import S3PathHandler

        IOPathManager.register_handler(S3PathHandler())
    except KeyError:
        logging.warning("S3PathHandler already registered.")
    except ImportError:
        logging.debug(
            "S3PathHandler couldn't be imported. Either missing fb-only files, or boto3 module."
        )

except ImportError:
    IOPathManager = None


class PathManager:
    """
    Wrapper for insulating OSS I/O (using Python builtin operations) from
    iopath's PathManager abstraction (for transparently handling various
示例#4
0
from pytorchvideo.data.dataset_manifest_utils import (
    EncodedVideoInfo,
    ImageDataset,
    ImageFrameInfo,
    VideoClipInfo,
    VideoDataset,
    VideoDatasetType,
    VideoInfo,
)
from pytorchvideo.data.utils import (
    DataclassFieldCaster,
    load_dataclass_dict_from_csv,
)
from pytorchvideo.data.video import Video

g_pathmgr.register_handler(ManifoldPathHandler(timeout_sec=600),
                           allow_override=True)

USER_ENVIRONMENT_MAP = {
    0: "none",
    1: "indoor",
    2: "nature",
    3: "crowded_environment",
    4: "urban",
}

USER_ACTIVITY_MAP = {
    0: "none",
    1: "walking",
    2: "running",
    3: "standing",
    4: "biking",