repo stringlengths 2 99 | file stringlengths 13 225 | code stringlengths 0 18.3M | file_length int64 0 18.3M | avg_line_length float64 0 1.36M | max_line_length int64 0 4.26M | extension_type stringclasses 1
value |
|---|---|---|---|---|---|---|
airflow | airflow-main/airflow/kubernetes/pod_launcher_deprecated.py | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | 12,009 | 36.41433 | 109 | py |
airflow | airflow-main/airflow/kubernetes/k8s_model.py | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | 2,045 | 33.1 | 80 | py |
airflow | airflow-main/airflow/kubernetes/volume_mount.py | #
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | 1,340 | 38.441176 | 104 | py |
airflow | airflow-main/airflow/kubernetes/kube_config.py | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | 4,852 | 48.020202 | 110 | py |
airflow | airflow-main/airflow/kubernetes/pod_runtime_info_env.py | #
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | 1,333 | 38.235294 | 107 | py |
airflow | airflow-main/airflow/kubernetes/pod_generator_deprecated.py | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | 11,962 | 37.71521 | 103 | py |
airflow | airflow-main/airflow/kubernetes/kubernetes_helper_functions.py | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | 4,556 | 31.55 | 87 | py |
airflow | airflow-main/airflow/kubernetes/volume.py | #
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | 1,319 | 37.823529 | 93 | py |
airflow | airflow-main/airflow/kubernetes/pod.py | #
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | 1,386 | 34.564103 | 112 | py |
airflow | airflow-main/airflow/kubernetes/__init__.py | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | 785 | 45.235294 | 62 | py |
airflow | airflow-main/airflow/kubernetes/kube_client.py | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | 5,310 | 35.627586 | 100 | py |
airflow | airflow-main/airflow/kubernetes/pod_launcher.py | #
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | 1,036 | 38.884615 | 96 | py |
airflow | airflow-main/airflow/kubernetes/pod_generator.py | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | 23,458 | 35.654688 | 108 | py |
airflow | airflow-main/airflow/serialization/serialized_objects.py | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | 62,329 | 40.692308 | 110 | py |
airflow | airflow-main/airflow/serialization/enums.py | #
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | 1,728 | 28.810345 | 68 | py |
airflow | airflow-main/airflow/serialization/serde.py | #
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | 12,611 | 33.459016 | 110 | py |
airflow | airflow-main/airflow/serialization/json_schema.py | #
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | 2,432 | 32.791667 | 103 | py |
airflow | airflow-main/airflow/serialization/__init__.py | #
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | 812 | 41.789474 | 62 | py |
airflow | airflow-main/airflow/serialization/helpers.py | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | 1,515 | 34.255814 | 85 | py |
airflow | airflow-main/airflow/serialization/pydantic/taskinstance.py | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | 3,768 | 31.773913 | 104 | py |
airflow | airflow-main/airflow/serialization/pydantic/dataset.py | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | 2,670 | 29.701149 | 107 | py |
airflow | airflow-main/airflow/serialization/pydantic/dag_run.py | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | 1,748 | 33.294118 | 93 | py |
airflow | airflow-main/airflow/serialization/pydantic/__init__.py | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | 785 | 45.235294 | 62 | py |
airflow | airflow-main/airflow/serialization/pydantic/job.py | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | 1,841 | 33.754717 | 106 | py |
airflow | airflow-main/airflow/serialization/serializers/numpy.py | #
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | 2,485 | 25.731183 | 100 | py |
airflow | airflow-main/airflow/serialization/serializers/builtin.py | #
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | 1,933 | 31.233333 | 85 | py |
airflow | airflow-main/airflow/serialization/serializers/timezone.py | #
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | 2,514 | 33.452055 | 85 | py |
airflow | airflow-main/airflow/serialization/serializers/datetime.py | #
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | 2,648 | 32.531646 | 104 | py |
airflow | airflow-main/airflow/serialization/serializers/pandas.py | #
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | 2,143 | 29.197183 | 83 | py |
airflow | airflow-main/airflow/serialization/serializers/bignum.py | #
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | 1,957 | 31.633333 | 89 | py |
airflow | airflow-main/airflow/serialization/serializers/kubernetes.py | #
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | 2,183 | 32.6 | 80 | py |
airflow | airflow-main/airflow/serialization/serializers/__init__.py | #
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | 787 | 42.777778 | 62 | py |
CLIP2Scene | CLIP2Scene-main/downstream.py | import os
import gc
import argparse
import MinkowskiEngine as ME
import pytorch_lightning as pl
from downstream.evaluate import evaluate
from utils.read_config import generate_config
from downstream.model_builder import make_model
from pytorch_lightning.plugins import DDPPlugin
from downstream.lightning_trainer import ... | 3,175 | 36.809524 | 109 | py |
CLIP2Scene | CLIP2Scene-main/pretrain.py | import os
import argparse
import torch.nn as nn
# import MinkowskiEngine as ME
import pytorch_lightning as pl
from utils.read_config import generate_config
from pretrain.model_builder import make_model
from pytorch_lightning.plugins import DDPPlugin
from pretrain.lightning_trainer import LightningPretrain
from pretrain... | 2,421 | 36.261538 | 108 | py |
CLIP2Scene | CLIP2Scene-main/evaluate.py | import torch
import argparse
from downstream.evaluate import evaluate
from utils.read_config import generate_config
from downstream.model_builder import make_model
from downstream.dataloader_kitti import make_data_loader as make_data_loader_kitti
from downstream.dataloader_nuscenes import make_data_loader as make_data_... | 2,938 | 37.671053 | 103 | py |
CLIP2Scene | CLIP2Scene-main/superpixel_segmenter.py | import os
import argparse
import numpy as np
from PIL import Image
from tqdm import tqdm
from multiprocessing import Pool
from skimage.segmentation import slic
from nuscenes.nuscenes import NuScenes
def compute_slic(cam_token):
cam = nusc.get("sample_data", cam_token)
im = Image.open(os.path.join(nusc.dataroo... | 2,523 | 33.108108 | 111 | py |
CLIP2Scene | CLIP2Scene-main/pretrain/dataloader_scannet.py | import os
import copy
import torch
import numpy as np
from PIL import Image
import MinkowskiEngine as ME
from torch.utils.data import Dataset
# import pc_utils
from plyfile import PlyData, PlyElement
import math
# from pc_utils import write_ply_rgb
import sys
sys.path.append("..")
# from MinkowskiEngine.utils import sp... | 8,764 | 35.67364 | 171 | py |
CLIP2Scene | CLIP2Scene-main/pretrain/lightning_datamodule.py | import torch
import numpy as np
import pytorch_lightning as pl
from torch.utils.data import DataLoader
from pretrain.dataloader_nuscenes import (
NuScenesMatchDataset,
minkunet_collate_pair_fn,
)
from pretrain.dataloader_kitti import (
KittiMatchDataset,
kitti_collate_pair_fn,
)
from pretrain.... | 5,540 | 33.203704 | 104 | py |
CLIP2Scene | CLIP2Scene-main/pretrain/lightning_trainer.py | import os
import re
import torch
import numpy as np
import torch.optim as optim
import MinkowskiEngine as ME
import pytorch_lightning as pl
from utils.chamfer_distance import ComputeCDLoss
from pretrain.criterion import NCELoss, DistillKL, semantic_NCELoss
from pytorch_lightning.utilities import rank_zero_only
from tor... | 14,055 | 39.507205 | 132 | py |
CLIP2Scene | CLIP2Scene-main/pretrain/dataloader_nuscenes.py | import os
import copy
import torch
import numpy as np
from PIL import Image
# import MinkowskiEngine as ME
from pyquaternion import Quaternion
from torch.utils.data import Dataset
from nuscenes.nuscenes import NuScenes
from nuscenes.utils.geometry_utils import view_points
from nuscenes.utils.splits import create_splits... | 18,090 | 39.113082 | 147 | py |
CLIP2Scene | CLIP2Scene-main/pretrain/model_builder.py | from model import (
SPVCNN,
MinkUNet,
# VoxelNet,
DilationFeatureExtractor,
PPKTFeatureExtractor,
Preprocessing,
DinoVitFeatureExtractor,
fusionNet,
maskClipFeatureExtractor,
)
def forgiving_state_restore(net, loaded_dict):
"""
Handle partial loading when some tensors don't... | 2,258 | 34.296875 | 90 | py |
CLIP2Scene | CLIP2Scene-main/pretrain/dataloader_nuscenes_spconv.py | import os
import copy
import torch
import numpy as np
from PIL import Image
from pyquaternion import Quaternion
from torch.utils.data import Dataset
from nuscenes.nuscenes import NuScenes
from nuscenes.utils.geometry_utils import view_points
from nuscenes.utils.splits import create_splits_scenes
from nuscenes.utils.dat... | 14,192 | 38.756303 | 114 | py |
CLIP2Scene | CLIP2Scene-main/pretrain/lightning_trainer_spconv.py | import os
import re
import torch
import numpy as np
import torch.optim as optim
import pytorch_lightning as pl
from pretrain.criterion import NCELoss
from pytorch_lightning.utilities import rank_zero_only
def bilinear_interpolate_torch(im, x, y):
"""
Args:
im: (H, W, C) [y, x]
x: (N)
y... | 8,642 | 35.778723 | 128 | py |
CLIP2Scene | CLIP2Scene-main/pretrain/pc_utils.py | """ Utility functions for processing point clouds.
Author: Charles R. Qi, Hao Su
Date: November 2016
"""
import os
import sys
import warnings
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
sys.path.append(BASE_DIR)
# Draw point cloud
from eulerangles import euler2mat
import math
# Point cloud IO
import numpy ... | 21,734 | 35.529412 | 104 | py |
CLIP2Scene | CLIP2Scene-main/pretrain/__init__.py | 0 | 0 | 0 | py | |
CLIP2Scene | CLIP2Scene-main/pretrain/criterion.py | import torch
import torch.nn as nn
import torch.nn.functional as F
import math
class NCELoss(nn.Module):
"""
Compute the PointInfoNCE loss
"""
def __init__(self, temperature):
super(NCELoss, self).__init__()
self.temperature = temperature
self.criterion = nn.CrossEntropyLoss()
... | 10,649 | 33.690554 | 120 | py |
CLIP2Scene | CLIP2Scene-main/pretrain/plyfile.py | # Copyright 2014 Darsh Ranjan
#
# This file is part of python-plyfile.
#
# python-plyfile is free software: you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any ... | 26,329 | 27.744541 | 72 | py |
CLIP2Scene | CLIP2Scene-main/pretrain/dataloader_kitti.py |
import os
import re
import torch
import numpy as np
from torch.utils.data import Dataset
# from MinkowskiEngine.utils import sparse_quantize
from utils.transforms import make_transforms_clouds
from torchsparse import SparseTensor
from torchsparse.utils.collate import sparse_collate_fn
from torchsparse.utils.quantize i... | 10,972 | 34.282958 | 154 | py |
CLIP2Scene | CLIP2Scene-main/downstream/dataloader_scannet.py | import os
import copy
import torch
import numpy as np
from PIL import Image
import MinkowskiEngine as ME
from torch.utils.data import Dataset
# import pc_utils
from plyfile import PlyData, PlyElement
import math
# from pc_utils import write_ply_rgb
import sys
sys.path.append("..")
# from MinkowskiEngine.utils import sp... | 10,704 | 35.660959 | 171 | py |
CLIP2Scene | CLIP2Scene-main/downstream/lightning_datamodule.py | import torch
import numpy as np
import pytorch_lightning as pl
from torch.utils.data import DataLoader
from utils.transforms import make_transforms_clouds
from downstream.dataloader_kitti import SemanticKITTIDataset
from downstream.dataloader_nuscenes import NuScenesDataset, custom_collate_fn
from downstream.dataloader... | 5,158 | 35.85 | 86 | py |
CLIP2Scene | CLIP2Scene-main/downstream/evaluate.py | import numpy as np
import torch
from tqdm import tqdm
from copy import deepcopy
from MinkowskiEngine import SparseTensor
# from torchsparse import SparseTensor
from utils.metrics import compute_IoU
CLASSES_NUSCENES = [
"barrier",
"bicycle",
"bus",
"car",
"construction_vehicle",
"motorcycle",
... | 5,359 | 26.628866 | 101 | py |
CLIP2Scene | CLIP2Scene-main/downstream/lightning_trainer.py | import os
import torch
import torch.optim as optim
import pytorch_lightning as pl
from MinkowskiEngine import SparseTensor
# from torchsparse import SparseTensor
from downstream.criterion import DownstreamLoss, unknown_aware_infoNCE
from pytorch_lightning.utilities import rank_zero_only
from utils.metrics import confus... | 8,081 | 40.446154 | 148 | py |
CLIP2Scene | CLIP2Scene-main/downstream/dataloader_nuscenes.py | import os
import torch
import numpy as np
from torch.utils.data import Dataset
from nuscenes.nuscenes import NuScenes
# from MinkowskiEngine.utils import sparse_quantize
from utils.transforms import make_transforms_clouds
from nuscenes.utils.splits import create_splits_scenes
from nuscenes.utils.data_classes import Lid... | 12,825 | 37.866667 | 149 | py |
CLIP2Scene | CLIP2Scene-main/downstream/model_builder.py | import torch
from model import MinkUNet, SPVCNN
def load_state_with_same_shape(model, weights):
"""
Load common weights in two similar models
(for instance between a pretraining and a downstream training)
"""
model_state = model.state_dict()
if list(weights.keys())[0].startswith("model."):
... | 3,677 | 41.275862 | 98 | py |
CLIP2Scene | CLIP2Scene-main/downstream/__init__.py | 0 | 0 | 0 | py | |
CLIP2Scene | CLIP2Scene-main/downstream/criterion.py | """
Lovasz-Softmax and Jaccard hinge loss in PyTorch
Maxim Berman 2018 ESAT-PSI KU Leuven (MIT License)
https://github.com/edwardzhou130/PolarSeg/blob/master/network/lovasz_losses.py
"""
from __future__ import print_function, division
import torch
import torch.nn as nn
from torch.autograd import Variable
import torch... | 14,503 | 32.496536 | 88 | py |
CLIP2Scene | CLIP2Scene-main/downstream/dataloader_kitti.py | import os
import re
import torch
import numpy as np
from torch.utils.data import Dataset
# from MinkowskiEngine.utils import sparse_quantize
from utils.transforms import make_transforms_clouds
# from torchsparse import SparseTensor
# from torchsparse.utils.collate import sparse_collate_fn
# from torchsparse.utils.quant... | 7,816 | 33.436123 | 147 | py |
CLIP2Scene | CLIP2Scene-main/utils/nuuuu.py | from nuscenes import NuScenes
import pickle
import os
import numpy as np
import json
from nuscenes.nuscenes import NuScenes
from nuscenes.utils.geometry_utils import view_points
from nuscenes.utils.splits import create_splits_scenes
from nuscenes.utils.data_classes import LidarPointCloud
CUSTOM_SPLIT = [
"scene-00... | 5,540 | 32.786585 | 108 | py |
CLIP2Scene | CLIP2Scene-main/utils/read_config.py | import yaml
from datetime import datetime as dt
def generate_config(file):
with open(file, "r") as f:
config = yaml.load(f, Loader=yaml.FullLoader)
config["datetime"] = dt.today().strftime("%d%m%y-%H%M")
return config
| 246 | 19.583333 | 63 | py |
CLIP2Scene | CLIP2Scene-main/utils/savemodel.py | import torch
import os
def save_checkpoint(self):
trained_epoch = self.cur_epoch + 1
ckpt_name = self.ckpt_dir / ('checkpoint_epoch_%d' % trained_epoch)
checkpoint_state = {}
checkpoint_state['epoch'] = trained_epoch
checkpoint_state['it'] = self.it
if isinstance(self.model, torch.nn.parallel.D... | 1,481 | 41.342857 | 76 | py |
CLIP2Scene | CLIP2Scene-main/utils/chamfer_distance.py | import torch
import torch.nn as nn
def compute_chamfer_distance(p1, p2):
'''
Calculate Chamfer Distance between two point sets
:param p1: size[bn, N, D]
:param p2: size[bn, M, D]
:param debug: whether need to output debug info
:return: sum of Chamfer Distance of two point sets
'''
dif... | 934 | 25.714286 | 85 | py |
CLIP2Scene | CLIP2Scene-main/utils/parse_dataset.py | import re
from nuscenes.nuscenes import NuScenes
from nuscenes.utils.splits import create_splits_scenes
if __name__ == "__main__":
"""
File used to generate the parametrizing splits
"""
nusc = NuScenes(
version="v1.0-trainval", dataroot="datasets/nuscenes/", verbose=True
)
phase_scenes... | 4,610 | 40.169643 | 91 | py |
CLIP2Scene | CLIP2Scene-main/utils/prompt_engineering.py | import numpy as np
import torch
import clip
import argparse
scannet_classes = ['wall', 'floor', 'cabinet', 'bed', 'chair', 'sofa', 'table', 'door', 'window', 'bookshelf', 'picture', 'counter', 'desk', 'curtain', 'refrigerator', 'shower curtain', 'toilet', 'sink', 'bathtub', 'other furniture']
nuscenes_classes = ["bar... | 17,422 | 171.50495 | 5,180 | py |
CLIP2Scene | CLIP2Scene-main/utils/scannet_utils.py | import os, sys
import csv
import json
try:
import numpy as np
except:
print("Failed to import numpy package.")
sys.exit(-1)
try:
import imageio
except:
print("Please install the module 'imageio' for image processing, e.g.")
print("pip install imageio")
sys.exit(-1)
#g_label_names = ['unannot... | 6,494 | 32.828125 | 247 | py |
CLIP2Scene | CLIP2Scene-main/utils/metrics.py | import torch
def confusion_matrix(preds, labels, num_classes):
hist = (
torch.bincount(
num_classes * labels + preds,
minlength=num_classes ** 2,
)
.reshape(num_classes, num_classes)
.float()
)
return hist
def compute_IoU_from_cmatrix(hist, ignore_... | 1,229 | 28.285714 | 81 | py |
CLIP2Scene | CLIP2Scene-main/utils/pc_utils.py | """ Utility functions for processing point clouds.
Author: Charles R. Qi, Hao Su
Date: November 2016
"""
import os
import sys
import warnings
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
sys.path.append(BASE_DIR)
# Draw point cloud
from eulerangles import euler2mat
import math
# Point cloud IO
import numpy ... | 21,735 | 35.469799 | 104 | py |
CLIP2Scene | CLIP2Scene-main/utils/__init__.py | 0 | 0 | 0 | py | |
CLIP2Scene | CLIP2Scene-main/utils/testfiles.py | import os
import copy
import torch
import numpy as np
from PIL import Image
# import MinkowskiEngine as ME
from pyquaternion import Quaternion
from torch.utils.data import Dataset
from nuscenes.nuscenes import NuScenes
from nuscenes.utils.geometry_utils import view_points
from nuscenes.utils.splits import create_splits... | 17,559 | 37.008658 | 166 | py |
CLIP2Scene | CLIP2Scene-main/utils/preprocess_scannet.py | import os
import sys
import time
import argparse
import json
import numpy as np
import multiprocessing as mp
from functools import partial
# sys.path.append("..")
sys.path.append("../utils")
import pc_utils
import scannet_utils
from plyfile import PlyData, PlyElement
g_label_names = scannet_utils.g_label_names
g_labe... | 5,424 | 37.75 | 125 | py |
CLIP2Scene | CLIP2Scene-main/utils/plyfile.py | # Copyright 2014 Darsh Ranjan
#
# This file is part of python-plyfile.
#
# python-plyfile is free software: you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any ... | 26,329 | 27.744541 | 72 | py |
CLIP2Scene | CLIP2Scene-main/utils/convert_clip_weights.py | import torch
import clip
import argparse
def parse_args():
parser = argparse.ArgumentParser(description='Extract and save the CLIP visual weights')
parser.add_argument('--model', default='RN50', choices=['RN50', 'RN101', 'RN50x4', 'RN50x16', 'RN50x64', 'ViT32', 'ViT16', 'ViT14'], help='clip model name')
p... | 4,232 | 46.033333 | 160 | py |
CLIP2Scene | CLIP2Scene-main/utils/transforms.py | import torch
import random
import numpy as np
# from torchvision.transforms import InterpolationMode
from torchvision.transforms import RandomResizedCrop
from torchvision.transforms.functional import resize, resized_crop, hflip
import math
class ComposeClouds:
"""
Compose multiple transformations on a point cl... | 11,427 | 33.841463 | 95 | py |
CLIP2Scene | CLIP2Scene-main/model/clip_model.py | import torch.nn as nn
import torch.nn.functional as F
import clip
class ClipFeatureExtractor(nn.Module):
"""
DINO Vision Transformer Feature Extractor.
"""
def __init__(self, config, preprocessing=None):
super(ClipFeatureExtractor, self).__init__()
self.encoder, preprocess = clip.load... | 1,158 | 28.717949 | 92 | py |
CLIP2Scene | CLIP2Scene-main/model/image_model.py | import os
import torch
import requests
import torch.nn as nn
import torch.nn.functional as F
import torchvision.transforms as T
import torch.utils.model_zoo as model_zoo
from torchvision.models.resnet import model_urls
from model.modules.resnet_encoder import resnet_encoders
import model.modules.dino.vision_transformer... | 8,571 | 34.27572 | 119 | py |
CLIP2Scene | CLIP2Scene-main/model/fusionNet.py | import os
import torch
import requests
import torch.nn as nn
import torch.nn.functional as F
import torchvision.transforms as T
import torch.utils.model_zoo as model_zoo
from torchvision.models.resnet import model_urls
from model.modules.resnet_encoder import resnet_encoders
import model.modules.dino.vision_transformer... | 2,487 | 42.649123 | 188 | py |
CLIP2Scene | CLIP2Scene-main/model/resnet.py | # 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.
# https://arxiv.org/abs/2007.10985
import torch.nn as nn
import MinkowskiEngine as ME
from MinkowskiEngine import MinkowskiNetwork
from mode... | 5,183 | 28.123596 | 88 | py |
CLIP2Scene | CLIP2Scene-main/model/spconv_backbone.py | from functools import partial
import numpy as np
import spconv
import torch.nn as nn
def post_act_block(
in_channels,
out_channels,
kernel_size,
indice_key=None,
stride=1,
padding=0,
conv_type="subm",
norm_fn=None,
):
if conv_type == "subm":
conv = spconv.SubMConv3d(
... | 12,158 | 28.512136 | 117 | py |
CLIP2Scene | CLIP2Scene-main/model/spvcnn.py | import torchsparse
import torchsparse.nn as spnn
import torch
import torch.nn.functional as F
import numpy as np
import pickle
from torch import nn
from torchsparse import PointTensor
from torchsparse import SparseTensor
from torchsparse.nn.utils import fapply
import torch
import torch.nn as nn
import torch.nn.function... | 18,958 | 36.691849 | 155 | py |
CLIP2Scene | CLIP2Scene-main/model/vit.py | # Copyright (c) OpenMMLab. All rights reserved.
import math
import warnings
from xmlrpc.client import Boolean
import torch
import torch.nn as nn
from mmcv.cnn import build_norm_layer
from mmcv.cnn.bricks.transformer import FFN, MultiheadAttention
from mmcv.cnn.utils.weight_init import (constant_init, kaiming_init,
... | 26,623 | 39.03609 | 128 | py |
CLIP2Scene | CLIP2Scene-main/model/minkunet.py | # 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.
# https://arxiv.org/abs/2007.10985
from model.resnet import ResNetBase, get_norm
from model.modules.common import ConvType, NormType, conv, co... | 11,742 | 28.804569 | 114 | py |
CLIP2Scene | CLIP2Scene-main/model/__init__.py | from model.image_model import *
from model.fusionNet import *
from model.maskclip_model import *
# from model.clip_model import *
try:
from model.spvcnn import SPVCNN as SPVCNN
except ImportError:
SPVCNN = None
try:
from model.minkunet import MinkUNet14A as MinkUNet
except ImportError:
MinkUNet = None... | 422 | 20.15 | 54 | py |
CLIP2Scene | CLIP2Scene-main/model/builder.py | # Copyright (c) OpenMMLab. All rights reserved.
import warnings
from mmcv.cnn import MODELS as MMCV_MODELS
from mmcv.cnn.bricks.registry import ATTENTION as MMCV_ATTENTION
from mmcv.utils import Registry
MODELS = Registry('models', parent=MMCV_MODELS)
ATTENTION = Registry('attention', parent=MMCV_ATTENTION)
BACKBONE... | 1,336 | 25.215686 | 71 | py |
CLIP2Scene | CLIP2Scene-main/model/maskclip_model.py | # Copyright (c) OpenMMLab. All rights reserved.
from mmcv.utils import print_log
from mmcv.cnn.bricks.transformer import FFN, MultiheadAttention
from mmcv.runner import BaseModule, ModuleList, _load_checkpoint
from torch.nn.modules.utils import _pair as to_2tuple
from mmseg.ops import resize
from mmseg.utils import get... | 37,830 | 37.603061 | 119 | py |
CLIP2Scene | CLIP2Scene-main/model/modules/resnet_encoder.py | import torch.nn as nn
from torchvision.models.resnet import ResNet
from torchvision.models.resnet import BasicBlock
from torchvision.models.resnet import Bottleneck
class ResNetEncoder(ResNet):
def __init__(self, **kwargs):
super().__init__(**kwargs)
del self.fc
del self.avgpool
def... | 1,314 | 22.070175 | 59 | py |
CLIP2Scene | CLIP2Scene-main/model/modules/common.py | # 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.
import collections
from enum import Enum
import MinkowskiEngine as ME
class NormType(Enum):
BATCH_NORM = 0
SPARSE_LAYER_NORM = 1
... | 5,815 | 28.673469 | 87 | py |
CLIP2Scene | CLIP2Scene-main/model/modules/__init__.py | 0 | 0 | 0 | py | |
CLIP2Scene | CLIP2Scene-main/model/modules/resnet_block.py | # 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.
import torch.nn as nn
from model.modules.common import ConvType, NormType, get_norm, conv
from MinkowskiEngine import MinkowskiReLU
class ... | 3,375 | 23.114286 | 81 | py |
CLIP2Scene | CLIP2Scene-main/model/modules/dino/vision_transformer.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | 15,379 | 40.013333 | 124 | py |
les-distance | les-distance-master/les/main_tori.py | import numpy as np
import matplotlib.pyplot as plt
from les import les_desc_comp, les_dist_comp
from comparisons import CompareIMD, CompareIMDOurApproach, CompareTDA, CompareGS, CompareGW
# Simulation parameters:
N = 1000 # Number of samples - reduced from N=3000 for faster computation times
ITER_NUM = 2 # Number of... | 7,358 | 46.173077 | 151 | py |
les-distance | les-distance-master/les/les.py | import numpy as np
import scipy.spatial as spat
import scipy.linalg as spla
from scipy.sparse.linalg import eigsh
APPROXEIG = True # Use [Tropp et al., 2017] approximation for the eigenvalues
M = 2 # Number of random vectors to use in [Tropp et al., 2017] (total = M x nev)
def _build_graph(data, si... | 3,314 | 31.184466 | 95 | py |
les-distance | les-distance-master/les/comparisons.py | import abc
import numpy as np
import scipy.spatial as spat
class CompareBase:
def __init__(self, iter_num, r_ratios, dict_keys):
self.all_distances = {key: np.zeros((iter_num, len(r_ratios))) for key in dict_keys}
@abc.abstractmethod
def _comp_desc(self, data):
"""
Compute the... | 6,554 | 39.96875 | 120 | py |
NSVF | NSVF-main/setup.py | # 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
# build clib
# _ext_src_root = ... | 1,224 | 28.878049 | 87 | py |
NSVF | NSVF-main/render.py | #!/usr/bin/env python3 -u
# 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 fairnr_cli.render_multigpu import cli_main
if __name__ == '__main__':
cli_main()
| 296 | 23.75 | 65 | py |
NSVF | NSVF-main/validate.py | #!/usr/bin/env python3 -u
# 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 fairnr_cli.validate import cli_main
if __name__ == '__main__':
cli_main()
| 289 | 23.166667 | 65 | py |
NSVF | NSVF-main/extract.py | #!/usr/bin/env python3 -u
# 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 fairnr_cli.extract import cli_main
if __name__ == '__main__':
cli_main()
| 288 | 23.083333 | 65 | py |
NSVF | NSVF-main/train.py | #!/usr/bin/env python3 -u
# 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.
import sys, os
from fairnr_cli.train import cli_main
from fairnr_cli.launch_slurm import launch
if __name__ == '__ma... | 573 | 26.333333 | 65 | py |
NSVF | NSVF-main/examples/data/nerf_render_ori.py | # 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.
import sys, os, argparse
import json
import bpy
import mathutils
from mathutils import Vector
import numpy as np
np.random.seed(2) # fixed s... | 7,120 | 32.275701 | 102 | py |
NSVF | NSVF-main/fairnr/renderer.py | # 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.
"""
This file is to simulate "generator" in fairseq
"""
import os, tempfile, shutil, glob
import time
import torch
import numpy as np
import ... | 10,725 | 41.904 | 145 | py |
NSVF | NSVF-main/fairnr/options.py | # 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.
import argparse
import sys
import torch
from fairseq import options
def parse_args_and_arch(*args, **kwargs):
return options.parse_arg... | 2,595 | 50.92 | 131 | py |
NSVF | NSVF-main/fairnr/__init__.py | # 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.
class ResetTrainerException(Exception):
pass
from . import data, tasks, models, modules, criterions
| 285 | 22.833333 | 65 | py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.