python_code
stringlengths
0
66.4k
# Copyright (c) Facebook, Inc. and its affiliates. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. # import math import torch import torch.nn.functional as F from torch.autograd import grad def gPenalty(inputs, loss, la...
# Copyright (c) Facebook, Inc. and its affiliates. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. # """ Some utilities """ import os import math import warnings import configargparse import torch from nets import ConvNe...
# Copyright (c) Facebook, Inc. and its affiliates. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. # import os import time import torch import torch.nn.functional as F from torch.autograd import grad from data import CIF...
# Copyright (c) Facebook, Inc. and its affiliates. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. # import math import time import numpy as np import scipy.stats as st from functools import partial import torch from torc...
# Copyright (c) Facebook, Inc. and its affiliates. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. # import os import numpy as np from PIL import Image import torch from torch.utils.data.sampler import SubsetRandomSampler...
# Copyright (c) Facebook, Inc. and its affiliates. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. # from functools import reduce import torch.nn as nn import torch.nn.functional as F class Identity(nn.Module): def ...
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved import detectron2.utils.comm as comm from detectron2.checkpoint import DetectionCheckpointer from detectron2.config import get_cfg from detectron2.engine import default_argument_parser, default_setup, launch from adapteacher...
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved from detectron2.config import CfgNode as CN def add_ateacher_config(cfg): """ Add config for semisupnet. """ _C = cfg _C.TEST.VAL_LOSS = True _C.MODEL.RPN.UNSUP_LOSS_WEIGHT = 1.0 _C.MODEL.RPN.LOSS = "CrossEntropy" ...
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved from .config import add_ateacher_config
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved from detectron2.checkpoint.c2_model_loading import align_and_update_state_dicts from detectron2.checkpoint import DetectionCheckpointer # for load_student_model from typing import Any from fvcore.common.checkpoint import _strip_prefix_if_present, _...
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved import torch from detectron2.config import CfgNode from detectron2.solver.lr_scheduler import WarmupCosineLR, WarmupMultiStepLR from .lr_scheduler import WarmupTwoStageMultiStepLR def build_lr_scheduler( cfg: CfgNode, optimizer: torch.optim.Op...
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved from bisect import bisect_right from typing import List import torch from detectron2.solver.lr_scheduler import _get_warmup_factor_at_iter class WarmupTwoStageMultiStepLR(torch.optim.lr_scheduler._LRScheduler): def __init__( self, ...
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved import numpy as np import torch import torch.nn as nn from torch.nn import functional as F from detectron2.modeling.meta_arch.build import META_ARCH_REGISTRY from detectron2.modeling.meta_arch.rcnn import GeneralizedRCNN from detectron2.config impo...
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved import torch.nn as nn import copy import torch from typing import Union, List, Dict, Any, cast from detectron2.modeling.backbone import ( ResNet, Backbone, build_resnet_backbone, BACKBONE_REGISTRY ) from detectron2.modeling.backbone....
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved from torch.nn.parallel import DataParallel, DistributedDataParallel import torch.nn as nn class EnsembleTSModel(nn.Module): def __init__(self, modelTeacher, modelStudent): super(EnsembleTSModel, self).__init__() if isinstance(...
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved from typing import Dict, Optional import torch from detectron2.structures import ImageList, Instances from detectron2.modeling.proposal_generator import RPN from detectron2.modeling.proposal_generator.build import PROPOSAL_GENERATOR_REGISTRY @PRO...
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved import torch from torch import nn from torch.nn import functional as F from detectron2.modeling.roi_heads.fast_rcnn import ( FastRCNNOutputLayers, FastRCNNOutputs, ) # focal loss class FastRCNNFocaltLossOutputLayers(FastRCNNOutputLayers): ...
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved import torch from typing import Dict, List, Optional, Tuple, Union from detectron2.structures import Boxes, ImageList, Instances, pairwise_iou from detectron2.modeling.proposal_generator.proposal_utils import ( add_ground_truth_to_proposals, ) f...
# Copyright (c) Facebook, Inc. and its affiliates. from .coco_evaluation import COCOEvaluator from .pascal_voc_evaluation import PascalVOCDetectionEvaluator # __all__ = [k for k in globals().keys() if not k.startswith("_")] __all__ = [ "COCOEvaluator", "PascalVOCDetectionEvaluator" ]
# Copyright (c) Facebook, Inc. and its affiliates. import contextlib import copy import io import itertools import json import logging import numpy as np import os import pickle from collections import OrderedDict import pycocotools.mask as mask_util import torch from pycocotools.coco import COCO from pycocotools.cocoe...
# -*- coding: utf-8 -*- # Copyright (c) Facebook, Inc. and its affiliates. import logging import numpy as np import os import tempfile import xml.etree.ElementTree as ET from collections import OrderedDict, defaultdict from functools import lru_cache import torch from detectron2.data import MetadataCatalog from detec...
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved import logging import numpy as np import operator import json import torch.utils.data from detectron2.utils.comm import get_world_size from detectron2.data.common import ( DatasetFromList, MapDataset, ) from detectron2.data.dataset_mapper im...
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved from .build import ( build_detection_test_loader, build_detection_semisup_train_loader, )
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved import logging import torchvision.transforms as transforms from adapteacher.data.transforms.augmentation_impl import ( GaussianBlur, ) def build_strong_augmentation(cfg, is_train): """ Create a list of :class:`Augmentation` from config...
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved import copy import logging import numpy as np from PIL import Image import torch import detectron2.data.detection_utils as utils import detectron2.data.transforms as T from detectron2.data.dataset_mapper import DatasetMapper from adapteacher.data.d...
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved import logging from detectron2.data.common import MapDataset, AspectRatioGroupedDataset class MapDatasetTwoCrop(MapDataset): """ Map a function over the elements in a dataset. This customized MapDataset transforms an image with two au...
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved import os import contextlib from detectron2.data import DatasetCatalog, MetadataCatalog from fvcore.common.timer import Timer # from fvcore.common.file_io import PathManager from iopath.common.file_io import PathManager from detectron2.data.dataset...
# Copyright (c) Facebook, Inc. and its affiliates. import functools import json import logging import multiprocessing as mp import numpy as np import os from itertools import chain import pycocotools.mask as mask_util from PIL import Image from detectron2.structures import BoxMode from detectron2.utils.comm import get...
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved import random from PIL import ImageFilter class GaussianBlur: """ Gaussian blur augmentation in SimCLR https://arxiv.org/abs/2002.05709 Adapted from MoCo: https://github.com/facebookresearch/moco/blob/master/moco/loader.py Note...
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved from detectron2.engine.hooks import HookBase import detectron2.utils.comm as comm import torch import numpy as np from contextlib import contextmanager class LossEvalHook(HookBase): def __init__(self, eval_period, model, data_loader, model_ou...
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved from detectron2.structures import pairwise_iou class OpenMatchTrainerProbe: def __init__(self, cfg): self.BOX_AP = 0.5 self.NUM_CLASSES = cfg.MODEL.ROI_HEADS.NUM_CLASSES # self.bbox_stat_list = ['compute_fp_gtoutlier', 'c...
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved import os import time import logging import torch from torch.nn.parallel import DistributedDataParallel from fvcore.nn.precise_bn import get_bn_modules import numpy as np from collections import OrderedDict import detectron2.utils.comm as comm from...
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved # from d2go.config import CfgNode as CN def add_aut_config(cfg): """ Add config for SemiSupSegRunner. """ _C = cfg #New added for discriminator _C.UNBIASEDTEACHER.DIS_LOSS_WEIGHT = 0.1 _C.UNBIASED...
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved import logging import os from collections import OrderedDict from functools import lru_cache import d2go.utils.abnormal_checker as abnormal_checker import detectron2.utils.comm as comm from d2go.config import CONFIG_SCALING...
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved # from .runner import SemiSupSegRunner, SemiSupHandTrackingRunner # noqa from .runner import BaseUnbiasedTeacherRunner # noqa from .runner import DAobjUnbiasedTeacherRunner # noqa
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved import torch.nn as nn import copy import torch from typing import Union, List, Dict, Any, cast from detectron2.modeling.backbone import ( ResNet, Backbone, build_resnet_backbone, BACKBONE_REGISTRY ) from detec...
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved import numpy as np import torch import torch.nn as nn from torch.nn import functional as F from detectron2.data.detection_utils import convert_image_to_rgb from detectron2.modeling import META_ARCH_REGISTRY, GeneralizedRCNN ...
# Copyright (c) Facebook, Inc. and its affiliates. from .coco_evaluation import COCOEvaluator from .pascal_voc_evaluation import PascalVOCDetectionEvaluator # __all__ = [k for k in globals().keys() if not k.startswith("_")] __all__ = [ "COCOEvaluator", "PascalVOCDetectionEvaluator" ]
# Copyright (c) Facebook, Inc. and its affiliates. import contextlib import copy import io import itertools import json import logging import numpy as np import os import pickle from collections import OrderedDict import pycocotools.mask as mask_util import torch from pycocotools.coco import COCO from pycocotools.cocoe...
# -*- coding: utf-8 -*- # Copyright (c) Facebook, Inc. and its affiliates. import logging import numpy as np import os import tempfile import xml.etree.ElementTree as ET from collections import OrderedDict, defaultdict from functools import lru_cache import torch from detectron2.data import MetadataCatalog from detec...
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved import contextlib import io import logging import os import json from detectron2.data import DatasetCatalog, MetadataCatalog from d2go.data.utils import CallFuncWithJsonFile from detectron2.utils.file_io import PathManager f...
# Copyright (c) Facebook, Inc. and its affiliates. import functools import json import logging import multiprocessing as mp import numpy as np import os from itertools import chain import pycocotools.mask as mask_util from PIL import Image from detectron2.structures import BoxMode from detectron2.utils.comm import get...
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved from detectron2.structures import pairwise_iou class OpenMatchTrainerProbe: def __init__(self, cfg): self.BOX_AP = 0.5 self.NUM_CLASSES = cfg.MODEL.ROI_HEADS.NUM_CLASSES # self.bbox_stat_list = ['c...
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved import logging import time from collections import OrderedDict from typing import Dict import detectron2.utils.comm as comm import numpy as np import torch from detectron2.engine import SimpleTrainer from detectron2.structur...
# Copyright (c) Facebook, Inc. and its affiliates. import torch import datetime import logging import math import time import sys from torch.distributed.distributed_c10d import reduce from utils.ap_calculator import APCalculator from utils.misc import SmoothedValue from utils.dist import ( all_gather_dict, all...
# Copyright (c) Facebook, Inc. and its affiliates. import torch def build_optimizer(args, model): params_with_decay = [] params_without_decay = [] for name, param in model.named_parameters(): if param.requires_grad is False: continue if args.filter_biases_wd and (len(param.sha...
# Copyright (c) Facebook, Inc. and its affiliates. import torch import torch.nn as nn import numpy as np import torch.nn.functional as F from utils.box_util import generalized_box3d_iou from utils.dist import all_reduce_average from utils.misc import huber_loss from scipy.optimize import linear_sum_assignment class M...
# Copyright (c) Facebook, Inc. and its affiliates. import argparse import os import sys import pickle import numpy as np import torch from torch.multiprocessing import set_start_method from torch.utils.data import DataLoader, DistributedSampler # 3DETR codebase specific imports from datasets import build_dataset fro...
# Copyright (c) Facebook, Inc. and its affiliates. """ Modified from https://github.com/facebookresearch/votenet Dataset for 3D object detection on SUN RGB-D (with support of vote supervision). A sunrgbd oriented bounding box is parameterized by (cx,cy,cz), (l,w,h) -- (dx,dy,dz) in upright depth coord (Z is up, Y i...
# Copyright (c) Facebook, Inc. and its affiliates. from .scannet import ScannetDetectionDataset, ScannetDatasetConfig from .sunrgbd import SunrgbdDetectionDataset, SunrgbdDatasetConfig DATASET_FUNCTIONS = { "scannet": [ScannetDetectionDataset, ScannetDatasetConfig], "sunrgbd": [SunrgbdDetectionDataset, Sunrgb...
# Copyright (c) Facebook, Inc. and its affiliates. """ Modified from https://github.com/facebookresearch/votenet Dataset for object bounding box regression. An axis aligned bounding box is parameterized by (cx,cy,cz) and (dx,dy,dz) where (cx,cy,cz) is the center point of the box, dx is the x-axis length of the box. "...
# Copyright (c) Facebook, Inc. and its affiliates. import torch import numpy as np from collections import deque from typing import List from utils.dist import is_distributed, barrier, all_reduce_sum def my_worker_init_fn(worker_id): np.random.seed(np.random.get_state()[1][0] + worker_id) @torch.jit.ignore def ...
# Copyright (c) Facebook, Inc. and its affiliates. from setuptools import setup, Extension from Cython.Build import cythonize import numpy as np # hacky way to find numpy include path # replace with actual path if this does not work np_include_path = np.__file__.replace("__init__.py", "core/include/") INCLUDE_PATH =...
# Copyright (c) Facebook, Inc. and its affiliates. """ Generic Code for Object Detection Evaluation Input: For each class: For each image: Predictions: box, score Groundtruths: box Output: For each class: precision-recal and average precision Autho...
# Copyright (c) Facebook, Inc. and its affiliates. """ Utility functions for processing point clouds. Author: Charles R. Qi and Or Litany """ import os import sys import torch # Point cloud IO import numpy as np from plyfile import PlyData, PlyElement # Mesh IO import trimesh # -----------------------------------...
# Copyright (c) Facebook, Inc. and its affiliates. import torch import os from utils.dist import is_primary def save_checkpoint( checkpoint_dir, model_no_ddp, optimizer, epoch, args, best_val_metrics, filename=None, ): if not is_primary(): return if filename is None: ...
# Copyright (c) Facebook, Inc. and its affiliates. import os from urllib import request import torch import pickle ## Define the weights you want and where to store them dataset = "scannet" encoder = "_masked" # or "" epoch = 1080 base_url = "https://dl.fbaipublicfiles.com/3detr/checkpoints" local_dir = "/tmp/" ###...
# Copyright (c) Facebook, Inc. and its affiliates. import numpy as np # boxes are axis aigned 2D boxes of shape (n,5) in FLOAT numbers with (x1,y1,x2,y2,score) """ Ref: https://www.pyimagesearch.com/2015/02/16/faster-non-maximum-suppression-python/ Ref: https://github.com/vickyboy47/nms-python/blob/master/nms.py """...
# Copyright (c) Facebook, Inc. and its affiliates. import torch try: from tensorboardX import SummaryWriter except ImportError: print("Cannot import tensorboard. Will log to txt files only.") SummaryWriter = None from utils.dist import is_primary class Logger(object): def __init__(self, log_dir=Non...
# Copyright (c) Facebook, Inc. and its affiliates. import numpy as np def check_aspect(crop_range, aspect_min): xy_aspect = np.min(crop_range[:2]) / np.max(crop_range[:2]) xz_aspect = np.min(crop_range[[0, 2]]) / np.max(crop_range[[0, 2]]) yz_aspect = np.min(crop_range[1:]) / np.max(crop_range[1:]) re...
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved """ Utilities for bounding box manipulation and GIoU. """ import torch from torchvision.ops.boxes import box_area from typing import List try: from box_intersection import batch_intersect except ImportError: print("Could not import cythonize...
# Copyright (c) Facebook, Inc. and its affiliates. """ Helper functions for calculating 2D and 3D bounding box IoU. Collected and written by Charles R. Qi Last modified: Apr 2021 by Ishan Misra """ import torch import numpy as np from scipy.spatial import ConvexHull, Delaunay from utils.misc import to_list_1d, to_lis...
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """ Helper functions and class to calculate Average Precisions for 3D object detection. """ import logging import os import sys from collectio...
# Copyright (c) Facebook, Inc. and its affiliates. import pickle import torch import torch.distributed as dist def is_distributed(): if not dist.is_available() or not dist.is_initialized(): return False return True def get_rank(): if not is_distributed(): return 0 return dist.get_ra...
# Copyright (c) Facebook, Inc. and its affiliates. import math from functools import partial import numpy as np import torch import torch.nn as nn from third_party.pointnet2.pointnet2_modules import PointnetSAModuleVotes from third_party.pointnet2.pointnet2_utils import furthest_point_sample from utils.pc_util import ...
# Copyright (c) Facebook, Inc. and its affiliates. from .model_3detr import build_3detr MODEL_FUNCS = { "3detr": build_3detr, } def build_model(args, dataset_config): model, processor = MODEL_FUNCS[args.model_name](args, dataset_config) return model, processor
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved """ Modified from DETR Transformer class. Copy-paste from torch.nn.Transformer with modifications: * positional encodings are passed in MHattention * extra LN at the end of encoder is removed * decoder returns a stack of activations fro...
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved """ Various positional encodings for the transformer. """ import math import torch from torch import nn import numpy as np from utils.pc_util import shift_scale_points class PositionEmbeddingCoordsSine(nn.Module): def __init__( self, ...
# Copyright (c) Facebook, Inc. and its affiliates. import torch.nn as nn from functools import partial import copy class BatchNormDim1Swap(nn.BatchNorm1d): """ Used for nn.Transformer that uses a HW x N x C rep """ def forward(self, x): """ x: HW x N x C permute to N x C x HW ...
# Copyright (c) Facebook, Inc. and its affiliates. ''' Modified based on Ref: https://github.com/erikwijmans/Pointnet2_PyTorch ''' import torch import torch.nn as nn from typing import List, Tuple class SharedMLP(nn.Sequential): def __init__( self, args: List[int], *, ...
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from setuptools import setup from torch.utils.cpp_extension import BuildExtension, CUDAExtension import glob import os.path as osp this_dir ...
# Copyright (c) Facebook, Inc. and its affiliates. ''' Modified based on: https://github.com/erikwijmans/Pointnet2_PyTorch ''' from __future__ import ( division, absolute_import, with_statement, print_function, unicode_literals, ) import torch from torch.autograd import Function import torch.nn as ...
# Copyright (c) Facebook, Inc. and its affiliates. ''' Testing customized ops. ''' import torch from torch.autograd import gradcheck import numpy as np import os import sys BASE_DIR = os.path.dirname(os.path.abspath(__file__)) sys.path.append(BASE_DIR) import pointnet2_utils def test_interpolation_grad(): batch...
# Copyright (c) Facebook, Inc. and its affiliates. ''' Pointnet2 layers. Modified based on: https://github.com/erikwijmans/Pointnet2_PyTorch Extended with the following: 1. Uniform sampling in each local region (sample_uniformly) 2. Return sampled points indices to support votenet. ''' import torch import torch.nn as ...
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. import pickle import numpy as np import os np.random.seed(1234) # we want 500 for training, 100 for test for wach class n = ...
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. import sys, time, os import numpy as np import torch import copy import utils from copy import deepcopy from tqdm import tqd...
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. import os import numpy as np from copy import deepcopy import pickle import time import uuid from subprocess import call #####...
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. import os,argparse,time import numpy as np from omegaconf import OmegaConf from copy import deepcopy import torch import torc...
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. from __future__ import print_function from PIL import Image import os import os.path import sys if sys.version_info[0] == 2:...
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. # https://github.com/pytorch/vision/blob/8635be94d1216f10fb8302da89233bd86445e449/torchvision/datasets/utils.py import os im...
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. from __future__ import print_function from PIL import Image import os import os.path import sys if sys.version_info[0] == 2: ...
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. from __future__ import print_function import os.path import sys import warnings import urllib.request if sys.version_info[0]...
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. import torch import utils class Shared(torch.nn.Module): def __init__(self,args): super(Shared, self).__init__()...
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. import torch import torch.nn as nn class Shared(torch.nn.Module): def __init__(self,args): super(Shared, self)...
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. import torch class Private(torch.nn.Module): def __init__(self, args): super(Private, self).__init__() ...
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. import torch import utils class Discriminator(torch.nn.Module): def __init__(self,args,task_id): super(Discrimina...
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. import pickle import numpy as np import os np.random.seed(1234) # we want 500 for training, 100 for test for wach class n = ...
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. import sys, time, os import numpy as np import torch import copy import utils from copy import deepcopy from tqdm import tqd...
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. import os import numpy as np from copy import deepcopy import pickle import time import uuid from subprocess import call #####...
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. import os,argparse,time import numpy as np from omegaconf import OmegaConf import torch import torch.backends.cudnn as cudnn...
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. from __future__ import print_function from PIL import Image import os import os.path import sys if sys.version_info[0] == 2:...
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. from __future__ import print_function import sys if sys.version_info[0] == 2: import cPickle as pickle else: import p...
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. # https://github.com/pytorch/vision/blob/8635be94d1216f10fb8302da89233bd86445e449/torchvision/datasets/utils.py import os im...
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. from __future__ import print_function from PIL import Image import os import os.path import sys if sys.version_info[0] == 2: ...
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. from __future__ import print_function from PIL import Image import torch import numpy as np import os.path import sys import ...
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. import torch import sys, os import numpy as np from PIL import Image import torch.utils.data as data from torchvision import d...
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. from __future__ import print_function import os.path import sys import warnings import urllib.request if sys.version_info[0]...
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. import torch import utils class Shared(torch.nn.Module): def __init__(self,args): super(Shared, self).__init__()...
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. import torch class Private(torch.nn.Module): def __init__(self, args): super(Private, self).__init__() ...
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. import torch import utils class Discriminator(torch.nn.Module): def __init__(self,args,task_id): super(Discrimina...