Search is not available for this dataset
repo stringlengths 2 152 ⌀ | file stringlengths 15 239 | code stringlengths 0 58.4M | file_length int64 0 58.4M | avg_line_length float64 0 1.81M | max_line_length int64 0 12.7M | extension_type stringclasses 364
values |
|---|---|---|---|---|---|---|
null | autoware-main/ansible/roles/cuda/defaults/main.yaml | install_cuda_drivers: true
| 27 | 13 | 26 | yaml |
null | autoware-main/ansible/roles/cuda/meta/main.yaml | 0 | 0 | 0 | yaml | |
null | autoware-main/ansible/roles/cuda/tasks/main.yaml | - name: Get CUDA architecture name
ansible.builtin.shell: |
if [ "$(uname -m)" = "x86_64" ]; then
echo "x86_64"
else
echo "sbsa"
fi
register: cuda_architecture
changed_when: false
- name: (tmp for Ubuntu 22.04) Add liburcu6 repository into sources.list for amd64
become: true
ansible.b... | 2,653 | 30.975904 | 134 | yaml |
null | autoware-main/ansible/roles/docker_engine/README.md | # docker_engine
This role installs [Docker Engine](https://docs.docker.com/engine/) following the [installation guide](https://docs.docker.com/engine/install/ubuntu/) and sets up execution from non-root users following the [manual](https://docs.docker.com/engine/install/linux-postinstall/).
## Inputs
None.
## Manua... | 2,031 | 30.75 | 275 | md |
null | autoware-main/ansible/roles/docker_engine/defaults/main.yaml | 0 | 0 | 0 | yaml | |
null | autoware-main/ansible/roles/docker_engine/meta/main.yaml | 0 | 0 | 0 | yaml | |
null | autoware-main/ansible/roles/docker_engine/tasks/main.yaml | - name: Uninstall old versions
become: true
ansible.builtin.apt:
name:
- docker
- docker-engine
- docker.io
- containerd
- runc
state: absent
update_cache: true
- name: Install dependencies for setting up apt sources
become: true
ansible.builtin.apt:
name:
- ... | 2,489 | 27.953488 | 254 | yaml |
null | autoware-main/ansible/roles/git_lfs/README.md | # Git Large File Storage
This role installs Git LFS. You can access detailed information about Git LFS with [this link](https://git-lfs.github.com/).
## Inputs
None.
## Manual Installation
```bash
sudo apt install git-lfs
git lfs install
```
| 247 | 15.533333 | 124 | md |
null | autoware-main/ansible/roles/git_lfs/defaults/main.yaml | 0 | 0 | 0 | yaml | |
null | autoware-main/ansible/roles/git_lfs/meta/main.yaml | 0 | 0 | 0 | yaml | |
null | autoware-main/ansible/roles/git_lfs/tasks/main.yaml | # https://github.com/git-lfs/git-lfs/wiki/Installation#debian-and-ubuntu
- name: Install Git LFS
become: true
ansible.builtin.apt:
name: git-lfs
state: latest
update_cache: true
# ref: https://github.com/ansible/ansible-lint/issues/1780
- name: Check if git lfs is installed # https://github.com/git-lfs... | 615 | 29.8 | 85 | yaml |
null | autoware-main/ansible/roles/nvidia_docker/README.md | # nvidia_docker
This role installs [NVIDIA Container Toolkit](https://github.com/NVIDIA/nvidia-docker) following the [installation guide](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/install-guide.html#docker).
## Inputs
None.
## Manual Installation
Install Nvidia Container Toolkit:
<!-- cspe... | 2,832 | 51.462963 | 215 | md |
null | autoware-main/ansible/roles/nvidia_docker/defaults/main.yaml | 0 | 0 | 0 | yaml | |
null | autoware-main/ansible/roles/nvidia_docker/meta/main.yaml | 0 | 0 | 0 | yaml | |
null | autoware-main/ansible/roles/nvidia_docker/tasks/main.yaml | - name: Authorize NVIDIA Docker GPG key
become: true
ansible.builtin.apt_key:
url: https://nvidia.github.io/nvidia-docker/gpgkey
- name: Save result of '. /etc/os-release;echo $ID$VERSION_ID'
ansible.builtin.shell: . /etc/os-release;echo $ID$VERSION_ID
register: nvidia_docker__distribution
changed_when: ... | 1,109 | 34.806452 | 138 | yaml |
null | autoware-main/ansible/roles/pacmod/README.md | # pacmod
This role sets up the prerequisites to install pacmod3_msgs following [this page](https://github.com/astuff/pacmod3_msgs#installation) and [this page](https://github.com/astuff/docker-builds/blob/e9f563ef04b0578ba0b545711ea3e41b20a51d27/ros2/foxy/ros-core/Dockerfile).
## Inputs
| Name | Required | Desc... | 1,024 | 40 | 268 | md |
null | autoware-main/ansible/roles/pacmod/defaults/main.yaml | 0 | 0 | 0 | yaml | |
null | autoware-main/ansible/roles/pacmod/meta/main.yaml | dependencies:
- role: autoware.dev_env.ros2
| 46 | 14.666667 | 31 | yaml |
null | autoware-main/ansible/roles/pacmod/tasks/main.yaml | - name: Install apt-transport-https
become: true
ansible.builtin.apt:
name: apt-transport-https
update_cache: true
- name: Save result of 'lsb_release -sc'
ansible.builtin.command: lsb_release -sc
register: pacmod__lsb_release
changed_when: false
# echo "deb [trusted=yes] https://s3.amazonaws.com/au... | 1,226 | 39.9 | 186 | yaml |
null | autoware-main/ansible/roles/plotjuggler/README.md | # plotjuggler
This role installs PlotJuggler. You can access detailed information about PlotJuggler with this [link](https://www.plotjuggler.io/).
## Inputs
None.
## Manual Installation
```bash
wget -O /tmp/amd64.env https://raw.githubusercontent.com/autowarefoundation/autoware/main/amd64.env && source /tmp/amd64.... | 403 | 22.764706 | 132 | md |
null | autoware-main/ansible/roles/plotjuggler/defaults/main.yaml | 0 | 0 | 0 | yaml | |
null | autoware-main/ansible/roles/plotjuggler/meta/main.yaml | dependencies:
- role: autoware.dev_env.ros2
| 46 | 14.666667 | 31 | yaml |
null | autoware-main/ansible/roles/plotjuggler/tasks/main.yaml | - name: Install plotjuggler
become: true
ansible.builtin.apt:
name:
- ros-{{ rosdistro }}-plotjuggler-ros
state: latest
update_cache: true
| 161 | 19.25 | 43 | yaml |
null | autoware-main/ansible/roles/pre_commit/README.md | # pre_commit
This role installs dependent tools for [pre-commit](https://pre-commit.com/).
## Inputs
| Name | Required | Description |
| -------------------- | -------- | --------------------------- |
| clang_format_version | false | The version of ClangFormat. |
## Manual Install... | 558 | 24.409091 | 77 | md |
null | autoware-main/ansible/roles/pre_commit/defaults/main.yaml | clang_format_version: 16.0.0
| 29 | 14 | 28 | yaml |
null | autoware-main/ansible/roles/pre_commit/meta/main.yaml | 0 | 0 | 0 | yaml | |
null | autoware-main/ansible/roles/pre_commit/tasks/main.yaml | - name: Install pre-commit
ansible.builtin.pip:
name: pre-commit
state: latest
executable: pip3
- name: Install clang-format
ansible.builtin.pip:
name: clang-format
version: "{{ clang_format_version }}"
executable: pip3
- name: Install Go
become: true
ansible.builtin.apt:
name: gol... | 365 | 18.263158 | 41 | yaml |
null | autoware-main/ansible/roles/rmw_implementation/README.md | # rmw_implementation
This role sets up ROS 2 RMW implementation following [this page](https://docs.ros.org/en/humble/How-To-Guides/Working-with-multiple-RMW-implementations.html).
## Inputs
| Name | Required | Description |
| ------------------ | -------- | ------------------- |
| rosdistro ... | 1,163 | 40.571429 | 158 | md |
null | autoware-main/ansible/roles/rmw_implementation/defaults/main.yaml | 0 | 0 | 0 | yaml | |
null | autoware-main/ansible/roles/rmw_implementation/meta/main.yaml | dependencies:
- role: autoware.dev_env.ros2
| 46 | 14.666667 | 31 | yaml |
null | autoware-main/ansible/roles/rmw_implementation/tasks/main.yaml | - name: Get dash-case name of rmw_implementation
ansible.builtin.shell: bash -c 'sed -e "s/_/-/g" <<< $(echo {{ rmw_implementation }})'
register: rmw_implementation__dash_case_rmw_implementation
changed_when: false
- name: Install ros-{{ rosdistro + '-' + rmw_implementation__dash_case_rmw_implementation.stdout }... | 698 | 33.95 | 99 | yaml |
null | autoware-main/ansible/roles/rocker/README.md | # rocker
This role installs [osrf/rocker](https://github.com/osrf/rocker) following the [installation guide](https://github.com/osrf/rocker/#installation).
## Inputs
None.
## Manual Installation
Install rocker:
```bash
# Taken from: https://github.com/osrf/rocker#installation
# Add the ROS 2 apt repository to yo... | 909 | 34 | 249 | md |
null | autoware-main/ansible/roles/rocker/defaults/main.yaml | 0 | 0 | 0 | yaml | |
null | autoware-main/ansible/roles/rocker/meta/main.yaml | 0 | 0 | 0 | yaml | |
null | autoware-main/ansible/roles/rocker/tasks/main.yaml | # sudo curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg
- name: Authorize ROS GPG key
become: true
ansible.builtin.get_url:
url: https://raw.githubusercontent.com/ros/rosdistro/master/ros.key
dest: /usr/share/keyrings/ros-archive-keyring... | 1,332 | 38.205882 | 219 | yaml |
null | autoware-main/ansible/roles/ros2/README.md | # ros2
This role installs [ROS 2](http://www.ros2.org/) following [this page](https://docs.ros.org/en/humble/Installation/Ubuntu-Install-Debians.html).
Additional steps may be needed depending on the `rosdistro` you choose.
<!-- TODO: Add these steps to the role if Humble requires. -->
```bash
$ sudo apt install so... | 2,913 | 42.492537 | 249 | md |
null | autoware-main/ansible/roles/ros2/defaults/main.yaml | installation_type: desktop
| 27 | 13 | 26 | yaml |
null | autoware-main/ansible/roles/ros2/meta/main.yaml | 0 | 0 | 0 | yaml | |
null | autoware-main/ansible/roles/ros2/tasks/main.yaml | - name: Install dependencies for setting up apt sources
become: true
ansible.builtin.apt:
name:
- curl
- gnupg
- lsb-release
update_cache: true
# sudo curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg
- name: Authorize ... | 1,866 | 35.607843 | 251 | yaml |
null | autoware-main/ansible/roles/ros2_dev_tools/README.md | # ros2_dev_tools
This role installs ROS 2 development tools following [this page](https://docs.ros.org/en/humble/Installation/Ubuntu-Development-Setup.html).
## Inputs
None.
## Manual Installation
```bash
# Taken from https://docs.ros.org/en/humble/Installation/Ubuntu-Development-Setup.html
sudo apt update && sudo... | 774 | 21.794118 | 140 | md |
null | autoware-main/ansible/roles/ros2_dev_tools/defaults/main.yaml | 0 | 0 | 0 | yaml | |
null | autoware-main/ansible/roles/ros2_dev_tools/meta/main.yaml | dependencies:
- role: autoware.dev_env.ros2
| 46 | 14.666667 | 31 | yaml |
null | autoware-main/ansible/roles/ros2_dev_tools/tasks/main.yaml | - name: Install apt packages
become: true
ansible.builtin.apt:
name:
- python3-colcon-mixin
- python3-flake8-docstrings
- python3-pip
- python3-pytest-cov
- ros-dev-tools
- python3-flake8-blind-except
- python3-flake8-builtins
- python3-flake8-class-newline
... | 715 | 25.518519 | 59 | yaml |
null | autoware-main/ansible/roles/tensorrt/README.md | # tensorrt
This role installs TensorRT and cuDNN following [this page](https://docs.nvidia.com/deeplearning/tensorrt/install-guide/index.html#installing).
## Inputs
| Name | Required | Description |
| ---------------- | -------- | ------------------------ |
| cudnn_version | true | Th... | 1,456 | 51.035714 | 318 | md |
null | autoware-main/ansible/roles/tensorrt/defaults/main.yaml | install_devel: true
| 20 | 9.5 | 19 | yaml |
null | autoware-main/ansible/roles/tensorrt/meta/main.yaml | dependencies:
- role: autoware.dev_env.cuda
| 46 | 14.666667 | 31 | yaml |
null | autoware-main/ansible/roles/tensorrt/tasks/main.yaml | - name: Install cuDNN and TensorRT
become: true
ansible.builtin.apt:
name:
- libcudnn8={{ cudnn_version }}
- libnvinfer8={{ tensorrt_version }}
- libnvinfer-plugin8={{ tensorrt_version }}
- libnvparsers8={{ tensorrt_version }}
- libnvonnxparsers8={{ tensorrt_version }}
allow_ch... | 1,431 | 26.018868 | 56 | yaml |
null | autoware-main/docker/README.md | # Docker images for Autoware
We have two types of Docker image: `development` and `prebuilt`.
1. The `development` image enables you to develop Autoware without setting up the local development environment.
2. The `prebuilt` image contains executables and enables you to try out Autoware quickly.
- Note that the pr... | 5,253 | 30.842424 | 278 | md |
null | autoware-main/docker/build.sh | #!/usr/bin/env bash
set -e
SCRIPT_DIR=$(readlink -f "$(dirname "$0")")
WORKSPACE_ROOT="$SCRIPT_DIR/../"
# Parse arguments
args=()
while [ "$1" != "" ]; do
case "$1" in
--no-cuda)
option_no_cuda=true
;;
--platform)
option_platform="$2"
shift
;;
--no-prebuilt)
... | 1,854 | 22.782051 | 117 | sh |
null | LPTN-main/README.md | # LPTN
### [Paper](https://arxiv.org/pdf/2105.09188.pdf) | [Supplementary Material](http://www4.comp.polyu.edu.hk/~cslzhang/paper/LPTN-cvpr21-supp.pdf) | [Poster](http://liangjie.xyz/LjHomepageFiles/paper_files/poster_LPTN.pdf)
> **High-Resolution Photorealistic Image Translation in Real-Time: A Laplacian Pyramid... | 5,024 | 41.948718 | 224 | md |
null | LPTN-main/codes/test.py | import logging
import torch
from os import path as osp
from codes.data import create_dataloader, create_dataset
from codes.models import create_model
from codes.train import parse_options
from codes.utils import (get_root_logger, get_time_str, make_exp_dirs)
from codes.utils.options import dict2str
def main():
#... | 1,742 | 29.578947 | 79 | py |
null | LPTN-main/codes/test_speed.py | import logging
import torch
from os import path as osp
from codes.data import create_dataloader, create_dataset
from codes.models import create_model
from codes.train import parse_options
from codes.utils import (get_root_logger, get_time_str, make_exp_dirs)
from codes.utils.options import dict2str
def main():
#... | 1,724 | 29.803571 | 79 | py |
null | LPTN-main/codes/train.py | import argparse
import datetime
import logging
import math
import random
import time
import torch
from os import path as osp
from codes.data import create_dataloader, create_dataset
from codes.data.data_sampler import EnlargedSampler
from codes.data.prefetch_dataloader import CPUPrefetcher, CUDAPrefetcher
from codes.m... | 9,689 | 37.915663 | 139 | py |
null | LPTN-main/codes/data/__init__.py | import importlib
import numpy as np
import random
import torch
import torch.utils.data
from functools import partial
from os import path as osp
from codes.data.prefetch_dataloader import PrefetchDataLoader
from codes.utils import get_root_logger, scandir
from codes.utils.dist_util import get_dist_info
__all__ = ['cre... | 4,616 | 35.354331 | 76 | py |
null | LPTN-main/codes/data/data_sampler.py | import math
import torch
from torch.utils.data.sampler import Sampler
class EnlargedSampler(Sampler):
"""Sampler that restricts data loading to a subset of the dataset.
Modified from torch.utils.data.distributed.DistributedSampler
Support enlarging the dataset for iteration-based training, for saving
... | 1,652 | 32.06 | 75 | py |
null | LPTN-main/codes/data/data_util.py | from os import path as osp
from codes.utils import scandir
def paired_paths_from_lmdb(folders, keys):
"""Generate paired paths from lmdb files.
Contents of lmdb. Taking the `lq.lmdb` for example, the file structure is:
lq.lmdb
├── data.mdb
├── lock.mdb
├── meta_info.txt
The data.mdb and ... | 5,132 | 35.404255 | 78 | py |
null | LPTN-main/codes/data/paired_image_dataset.py | import random
from torch.utils import data as data
from torchvision.transforms.functional import normalize
from codes.data.data_util import (paired_paths_from_folder,
paired_paths_from_lmdb)
from codes.data.transforms import augment, paired_random_crop
from codes.utils import FileClie... | 3,337 | 38.270588 | 100 | py |
null | LPTN-main/codes/data/prefetch_dataloader.py | import queue as Queue
import threading
import torch
from torch.utils.data import DataLoader
class PrefetchGenerator(threading.Thread):
"""A general prefetch generator.
Ref:
https://stackoverflow.com/questions/7323664/python-generator-pre-fetch
Args:
generator: Python generator.
num_p... | 3,156 | 23.858268 | 77 | py |
null | LPTN-main/codes/data/transforms.py | import cv2
import random
import numpy as np
import torchvision.transforms.functional as F
import torchvision.transforms as transforms
def mod_crop(img, scale):
"""Mod crop images, used during testing.
Args:
img (ndarray): Input image.
scale (int): Scale factor.
Returns:
ndarray: R... | 6,787 | 34.354167 | 97 | py |
null | LPTN-main/codes/data/unpair_image_dataset.py | import random
from torch.utils import data as data
from torchvision.transforms.functional import normalize
from codes.data.data_util import (paths_from_folder, paths_from_lmdb)
from codes.data.transforms import augment, unpaired_random_crop
from codes.utils import FileClient, imfrombytes, img2tensor
class UnPairedIma... | 3,330 | 37.287356 | 100 | py |
null | LPTN-main/codes/metrics/__init__.py | from .psnr_ssim import calculate_psnr, calculate_ssim
__all__ = ['calculate_psnr', 'calculate_ssim']
| 102 | 24.75 | 53 | py |
null | LPTN-main/codes/metrics/metric_util.py | import numpy as np
from basicsr.utils.matlab_functions import bgr2ycbcr
def reorder_image(img, input_order='HWC'):
"""Reorder images to 'HWC' order.
If the input_order is (h, w), return (h, w, 1);
If the input_order is (c, h, w), return (h, w, c);
If the input_order is (h, w, c), return as it is.
... | 1,313 | 26.375 | 75 | py |
null | LPTN-main/codes/metrics/psnr_ssim.py | import cv2
import numpy as np
from basicsr.metrics.metric_util import reorder_image, to_y_channel
def calculate_psnr(img1,
img2,
crop_border,
input_order='HWC',
test_y_channel=False):
"""Calculate PSNR (Peak Signal-to-Noise Ratio).
... | 4,731 | 32.323944 | 76 | py |
null | LPTN-main/codes/models/__init__.py | import importlib
from os import path as osp
from codes.utils import get_root_logger, scandir
# automatically scan and import model modules
# scan all the files under the 'models' folder and collect files ending with
# '_model.py'
model_folder = osp.dirname(osp.abspath(__file__))
model_filenames = [
osp.splitext(o... | 1,141 | 25.55814 | 76 | py |
null | LPTN-main/codes/models/base_model.py | import logging
import os
import torch
from collections import OrderedDict
from torch.nn.parallel import DataParallel, DistributedDataParallel
from codes.models import lr_scheduler as lr_scheduler
from codes.utils.dist_util import master_only
logger = logging.getLogger('codes')
class BaseModel():
"""Base model.""... | 10,175 | 34.957597 | 118 | py |
null | LPTN-main/codes/models/lptn_model.py | import importlib
import torch
from collections import OrderedDict
from copy import deepcopy
from os import path as osp
from tqdm import tqdm
import time
import numpy as np
from codes.models.archs import define_network
from codes.models.base_model import BaseModel
from codes.models.losses import compute_gradient_penalt... | 9,950 | 37.273077 | 91 | py |
null | LPTN-main/codes/models/lptn_test_model.py | import importlib
import torch
from collections import OrderedDict
from copy import deepcopy
from os import path as osp
from tqdm import tqdm
import time
import numpy as np
from codes.models.archs import define_network
from codes.models.base_model import BaseModel
from codes.utils import get_root_logger, imwrite, tenso... | 6,206 | 37.79375 | 121 | py |
null | LPTN-main/codes/models/lr_scheduler.py | import math
from collections import Counter
from torch.optim.lr_scheduler import _LRScheduler
class MultiStepRestartLR(_LRScheduler):
""" MultiStep with restarts learning rate scheme.
Args:
optimizer (torch.nn.optimizer): Torch optimizer.
milestones (list): Iterations that will decrease learn... | 4,319 | 35.302521 | 79 | py |
null | LPTN-main/codes/models/archs/LPTN_arch.py | import torch.nn as nn
import torch.nn.functional as F
import torch
class Lap_Pyramid_Bicubic(nn.Module):
"""
"""
def __init__(self, num_high=3):
super(Lap_Pyramid_Bicubic, self).__init__()
self.interpolate_mode = 'bicubic'
self.num_high = num_high
def pyramid_decom(self, img)... | 7,019 | 35.373057 | 154 | py |
null | LPTN-main/codes/models/archs/LPTN_paper_arch.py | import torch.nn as nn
import torch.nn.functional as F
import torch
class Lap_Pyramid_Bicubic(nn.Module):
"""
"""
def __init__(self, num_high=3):
super(Lap_Pyramid_Bicubic, self).__init__()
self.interpolate_mode = 'bicubic'
self.num_high = num_high
def pyramid_decom(self, img)... | 6,986 | 35.202073 | 154 | py |
null | LPTN-main/codes/models/archs/__init__.py | import importlib
from os import path as osp
from codes.utils import scandir
# automatically scan and import arch modules
# scan all the files under the 'archs' folder and collect files ending with
# '_arch.py'
arch_folder = osp.dirname(osp.abspath(__file__))
arch_filenames = [
osp.splitext(osp.basename(v))[0] for... | 1,228 | 25.148936 | 75 | py |
null | LPTN-main/codes/models/archs/arch_util.py | import math
import torch
from torch import nn as nn
from torch.nn import functional as F
from torch.nn import init as init
from torch.nn.modules.batchnorm import _BatchNorm
from codes.utils import get_root_logger
@torch.no_grad()
def default_init_weights(module_list, scale=1, bias_fill=0, **kwargs):
"""Initialize... | 8,470 | 33.434959 | 78 | py |
null | LPTN-main/codes/models/archs/discriminator_arch.py | from torch import nn as nn
def discriminator_block(in_filters, out_filters, normalization=False):
layers = [nn.Conv2d(in_filters, out_filters, 3, stride=2, padding=1)]
layers.append(nn.LeakyReLU(0.2))
if normalization:
layers.append(nn.InstanceNorm2d(out_filters, affine=True))
return layers
cl... | 4,202 | 37.559633 | 102 | py |
null | LPTN-main/codes/models/losses/__init__.py | from .losses import (CharbonnierLoss, GANLoss, L1Loss, MSELoss, PerceptualLoss,
WeightedTVLoss, g_path_regularize, compute_gradient_penalty,
r1_penalty)
__all__ = [
'L1Loss', 'MSELoss', 'CharbonnierLoss', 'WeightedTVLoss', 'PerceptualLoss',
'GANLoss', 'compute_gradient... | 367 | 39.888889 | 81 | py |
null | LPTN-main/codes/models/losses/loss_util.py | import functools
from torch.nn import functional as F
def reduce_loss(loss, reduction):
"""Reduce loss as specified.
Args:
loss (Tensor): Elementwise loss tensor.
reduction (str): Options are 'none', 'mean' and 'sum'.
Returns:
Tensor: Reduced loss tensor.
"""
reduction_enu... | 2,902 | 29.557895 | 78 | py |
null | LPTN-main/codes/models/losses/losses.py | import math
import torch
import numpy as np
from torch import autograd as autograd
from torch import nn as nn
from torch.nn import functional as F
from torch.autograd import Variable
from codes.models.losses.loss_util import weighted_loss
_reduction_modes = ['none', 'mean', 'sum']
@weighted_loss
def l1_loss(pred, t... | 15,577 | 34.811494 | 107 | py |
null | LPTN-main/codes/utils/__init__.py | from .file_client import FileClient
from .img_util import crop_border, imfrombytes, img2tensor, imwrite, tensor2img
from .logger import (MessageLogger, get_root_logger,
init_tb_logger, init_wandb_logger)
from .misc import (check_resume, get_time_str, make_exp_dirs, mkdir_and_rename,
... | 806 | 24.21875 | 79 | py |
null | LPTN-main/codes/utils/dist_util.py | # Modified from https://github.com/open-mmlab/mmcv/blob/master/mmcv/runner/dist_utils.py # noqa: E501
import functools
import os
import subprocess
import torch
import torch.distributed as dist
import torch.multiprocessing as mp
def init_dist(launcher, backend='nccl', **kwargs):
if mp.get_start_method(allow_none=... | 2,616 | 30.53012 | 102 | py |
null | LPTN-main/codes/utils/download_util.py | import math
import requests
from tqdm import tqdm
from .misc import sizeof_fmt
def download_file_from_google_drive(file_id, save_path):
"""Download files from google drive.
Ref:
https://stackoverflow.com/questions/25010369/wget-curl-large-file-from-google-drive # noqa E501
Args:
file_id (s... | 2,124 | 28.929577 | 100 | py |
null | LPTN-main/codes/utils/file_client.py | # Modified from https://github.com/open-mmlab/mmcv/blob/master/mmcv/fileio/file_client.py # noqa: E501
from abc import ABCMeta, abstractmethod
class BaseStorageBackend(metaclass=ABCMeta):
"""Abstract class of storage backends.
All backends need to implement two apis: ``get()`` and ``get_text()``.
``get(... | 6,288 | 33.179348 | 103 | py |
null | LPTN-main/codes/utils/flow_util.py | # Modified from https://github.com/open-mmlab/mmcv/blob/master/mmcv/video/optflow.py # noqa: E501
import cv2
import numpy as np
import os
def flowread(flow_path, quantize=False, concat_axis=0, *args, **kwargs):
"""Read an optical flow map.
Args:
flow_path (ndarray or str): Flow path.
quantiz... | 6,335 | 34.005525 | 98 | py |
null | LPTN-main/codes/utils/img_util.py | import cv2
import math
import numpy as np
import os
import torch
from torchvision.utils import make_grid
from PIL import Image, ImageFilter
import random
###manage groundtruth
def UnMaskFilterGaussian(img, Rad, Perc, Thr):
single_c = False
if img.ndim == 3 and img.shape[2] == 1:
img = img[:,:,0]
... | 7,470 | 32.959091 | 88 | py |
null | LPTN-main/codes/utils/lmdb_util.py | import cv2
import lmdb
import sys
from multiprocessing import Pool
from os import path as osp
from tqdm import tqdm
def make_lmdb_from_imgs(data_path,
lmdb_path,
img_path_list,
keys,
batch=5000,
comp... | 7,267 | 33.942308 | 79 | py |
null | LPTN-main/codes/utils/logger.py | import datetime
import logging
import time
from .dist_util import get_dist_info, master_only
class MessageLogger():
"""Message logger for printing.
Args:
opt (dict): Config. It contains the following keys:
name (str): Exp name.
logger (dict): Contains 'print_freq' (str) for l... | 5,085 | 32.906667 | 79 | py |
null | LPTN-main/codes/utils/misc.py | import numpy as np
import os
import random
import time
import torch
from os import path as osp
from .dist_util import master_only
from .logger import get_root_logger
def set_random_seed(seed):
"""Set random seeds."""
random.seed(seed)
np.random.seed(seed)
torch.manual_seed(seed)
torch.cuda.manual... | 4,480 | 31.007143 | 79 | py |
null | LPTN-main/codes/utils/options.py | import yaml
from collections import OrderedDict
from os import path as osp
def ordered_yaml():
"""Support OrderedDict for yaml.
Returns:
yaml Loader and Dumper.
"""
try:
from yaml import CDumper as Dumper
from yaml import CLoader as Loader
except ImportError:
from ... | 3,757 | 32.855856 | 88 | py |
null | LPTN-main/options/test/LPTN/test_FiveK.yml | # general settings
name: LPTN_FiveK_480p
model_type: LPTNTestModel
num_gpu: 1 # set num_gpu: 0 for cpu mode
manual_seed: 10
# dataset and data loader settings
datasets:
test:
name: FiveK_val
type: PairedImageDataset
# dataroot_gt: datasets/FiveK/FiveK_480p/test/B
# dataroot_lq: datasets/FiveK/FiveK_4... | 927 | 21.095238 | 76 | yml |
null | LPTN-main/options/test/LPTN/test_speed_FiveK.yml | # general settings
name: LPTN_test_speed
model_type: LPTNTestModel
num_gpu: 1 # set num_gpu: 0 for cpu mode
manual_seed: 10
# dataset and data loader settings
datasets:
test:
name: FiveK_val
type: PairedImageDataset
# dataroot_gt: datasets/FiveK/FiveK_480p/test/B
# dataroot_lq: datasets/FiveK/FiveK_4... | 855 | 22.135135 | 105 | yml |
null | LPTN-main/options/train/LPTN/train_FiveK.yml | # general settings
name: LPTN_FiveK
model_type: LPTNModel
num_gpu: 2 # set num_gpu: 0 for cpu mode
manual_seed: 10
# dataset and data loader settings
datasets:
train:
name: FiveK
type: UnPairedImageDataset
# (for disk)
# dataroot_gt: datasets/FiveK/FiveK_480p/train/B
# dataroot_lq: datasets/FiveK/... | 2,443 | 18.709677 | 118 | yml |
null | LPTN-main/options/train/LPTN/train_FiveK_paper.yml | # general settings
name: LPTN_FiveK_paper
model_type: LPTNModel
num_gpu: 1 # set num_gpu: 0 for cpu mode
manual_seed: 10
# dataset and data loader settings
datasets:
train:
name: FiveK
type: UnPairedImageDataset
# (for disk)
# dataroot_gt: datasets/FiveK/FiveK_480p/train/B
# dataroot_lq: datasets/... | 2,454 | 18.798387 | 118 | yml |
null | LPTN-main/scripts/download_gdrive.py | import argparse
from codes.utils.download_util import download_file_from_google_drive
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('--id', type=str, help='File id')
parser.add_argument('--output', type=str, help='Save path')
args = parser.parse_args()
downloa... | 370 | 27.538462 | 69 | py |
null | LPTN-main/scripts/data_preparation/create_lmdb.py | from codes.utils import scandir
from codes.utils.lmdb_util import make_lmdb_from_imgs
def create_lmdb():
folder_path = 'datasets/FiveK/FiveK_480p/train/A'
lmdb_path = 'datasets/FiveK/FiveK_train_source.lmdb'
img_path_list, keys = prepare_keys(folder_path)
make_lmdb_from_imgs(folder_path, lmdb_path, i... | 1,362 | 32.243902 | 76 | py |
null | LPTN-main/scripts/data_preparation/download_datasets.py | import argparse
import glob
import os
from os import path as osp
from codes.utils.download_util import download_file_from_google_drive
def download_dataset(file_ids):
save_path_root = './datasets'
os.makedirs(save_path_root, exist_ok=True)
for file_name, file_id in file_ids.items():
save_path = o... | 1,989 | 34.535714 | 77 | py |
null | msaexp-main/.readthedocs.yml | # .readthedocs.yml
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
# Required
version: 2
# Set the version of Python and other tools you might need
build:
os: ubuntu-22.04
tools:
python: "3.10"
# Build documentation in the docs/ directory wit... | 546 | 19.259259 | 75 | yml |
null | msaexp-main/setup.py | #!/usr/bin/env python
from setuptools import setup
setup() | 59 | 14 | 28 | py |
null | msaexp-main/.github/workflows/publish-to-pypi.yml | name: Publish-to-pypi
on:
release:
types: [released]
# push:
# branches:
# - master
# pull_request:
workflow_dispatch:
jobs:
build_sdist:
name: source distribution
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fe... | 1,003 | 21.818182 | 80 | yml |
null | msaexp-main/.github/workflows/python-package.yml | # This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: CI
on:
push:
branches:
- main
pull_request:
jobs:
build:
runs-on:... | 1,749 | 25.119403 | 122 | yml |
null | msaexp-main/docs/conf.py | # -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
#
# Astropy documentation build configuration file.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this file.
#
# All configurati... | 6,782 | 36.475138 | 89 | py |
null | msaexp-main/msaexp/__init__.py | from .version import __version__
| 33 | 16 | 32 | py |
null | msaexp-main/msaexp/drizzle.py | """
Tools for drizzle-combining MSA spectra
"""
import glob
import warnings
from tqdm import tqdm
import numpy as np
import matplotlib.pyplot as plt
import scipy.ndimage as nd
import jwst.datamodels
import astropy.io.fits as pyfits
import grizli.utils
from . import utils
# Parameter defaults
DRIZZLE_PARAMS = dict(... | 42,583 | 33.480972 | 506 | py |