file_path stringlengths 3 280 | file_language stringclasses 66
values | content stringlengths 1 1.04M | repo_name stringlengths 5 92 | repo_stars int64 0 154k | repo_description stringlengths 0 402 | repo_primary_language stringclasses 108
values | developer_username stringlengths 1 25 | developer_name stringlengths 0 30 | developer_company stringlengths 0 82 |
|---|---|---|---|---|---|---|---|---|---|
handyinfer/visualization/__init__.py | Python | from .vis_depth_estimation import vis_depth_estimation
from .vis_face_alignment import vis_face_alignment
__all__ = ['vis_face_alignment', 'vis_depth_estimation']
| xinntao/HandyInfer | 7 | Python | xinntao | Xintao | Tencent | |
handyinfer/visualization/vis_depth_estimation.py | Python | import matplotlib
import matplotlib.cm
import numpy as np
import torch
def vis_depth_estimation(value,
vmin=None,
vmax=None,
cmap='gray_r',
invalid_val=-99,
invalid_mask=None,
... | xinntao/HandyInfer | 7 | Python | xinntao | Xintao | Tencent | |
handyinfer/visualization/vis_face_alignment.py | Python | import cv2
import numpy as np
def vis_face_alignment(img, landmarks, save_path=None, to_bgr=False):
img = np.copy(img)
h, w = img.shape[0:2]
circle_size = int(max(h, w) / 150)
if to_bgr:
img = cv2.cvtColor(img, cv2.COLOR_RGB2BGR)
for landmarks_face in landmarks:
for lm in landmark... | xinntao/HandyInfer | 7 | Python | xinntao | Xintao | Tencent | |
inference/get_data.sh | Shell | # salient object detection
wget https://huggingface.co/Xintao/HandyInfer/resolve/main/data/jump_cat.png -P inference/data
| xinntao/HandyInfer | 7 | Python | xinntao | Xintao | Tencent | |
inference/inference_depth_estimation.py | Python | import argparse
import cv2
import torch
from handyinfer.depth_estimation import init_depth_estimation_model
from handyinfer.utils import img2tensor, tensor2img_fast
def main(args):
device = torch.device('cuda')
depth_net = init_depth_estimation_model(args.model_name)
img = cv2.imread(args.img_path)
... | xinntao/HandyInfer | 7 | Python | xinntao | Xintao | Tencent | |
inference/inference_face_alignment.py | Python | import argparse
import cv2
import torch
from handyinfer.face_alignment import init_face_alignment_model, landmark_98_to_68
from handyinfer.visualization import vis_face_alignment
def main(args):
# initialize model
align_net = init_face_alignment_model(args.model_name)
img = cv2.imread(args.img_path)
... | xinntao/HandyInfer | 7 | Python | xinntao | Xintao | Tencent | |
inference/inference_saliency_detection.py | Python | import argparse
import cv2
import torch
import torch.nn.functional as F
from handyinfer.saliency_detection import init_saliency_detection_model
from handyinfer.utils import tensor2img_fast
def main(args):
# initialize model
sod_net = init_saliency_detection_model(args.model_name)
img = cv2.imread(args.i... | xinntao/HandyInfer | 7 | Python | xinntao | Xintao | Tencent | |
setup.py | Python | #!/usr/bin/env python
from setuptools import find_packages, setup
import os
import subprocess
import time
version_file = 'handyinfer/version.py'
def readme():
with open('README.md', encoding='utf-8') as f:
content = f.read()
return content
def get_git_hash():
def _minimal_ext_cmd(cmd):
... | xinntao/HandyInfer | 7 | Python | xinntao | Xintao | Tencent | |
clean_bib.py | Python | import argparse
import bibtexparser
from bibtexparser.bibdatabase import (BibDatabase, BibDataString, BibDataStringExpression)
from bibtexparser.bparser import BibTexParser
from bibtexparser.bwriter import BibTexWriter
# bibtex strings (e.g., #cvpr#) for conferences
CONFERENCE_BIBSTR = {
'CVPR': '#cvpr#',
'CV... | xinntao/HandyLatex | 16 | Collections of Beautiful Latex Snippets | Python | xinntao | Xintao | Tencent |
setup.py | Python | #!/usr/bin/env python
from setuptools import find_packages, setup
import os
import subprocess
import sys
import time
import torch
from torch.utils.cpp_extension import BuildExtension, CppExtension, CUDAExtension
version_file = 'basicsr/version.py'
def readme():
with open('README.md', encoding='utf-8') as f:
... | xinntao/ProjectTemplate-Python | 234 | Python Project Template | Python | xinntao | Xintao | Tencent |
cog_predict.py | Python | # flake8: noqa
# This file is used for deploying replicate models
# running: cog predict -i img=@inputs/00017_gray.png -i version='General - v3' -i scale=2 -i face_enhance=True -i tile=0
# push: cog push r8.im/xinntao/realesrgan
import os
os.system('pip install gfpgan')
os.system('python setup.py develop')
import cv... | xinntao/Real-ESRGAN | 34,354 | Real-ESRGAN aims at developing Practical Algorithms for General Image/Video Restoration. | Python | xinntao | Xintao | Tencent |
inference_realesrgan.py | Python | import argparse
import cv2
import glob
import os
from basicsr.archs.rrdbnet_arch import RRDBNet
from basicsr.utils.download_util import load_file_from_url
from realesrgan import RealESRGANer
from realesrgan.archs.srvgg_arch import SRVGGNetCompact
def main():
"""Inference demo for Real-ESRGAN.
"""
parser ... | xinntao/Real-ESRGAN | 34,354 | Real-ESRGAN aims at developing Practical Algorithms for General Image/Video Restoration. | Python | xinntao | Xintao | Tencent |
inference_realesrgan_video.py | Python | import argparse
import cv2
import glob
import mimetypes
import numpy as np
import os
import shutil
import subprocess
import torch
from basicsr.archs.rrdbnet_arch import RRDBNet
from basicsr.utils.download_util import load_file_from_url
from os import path as osp
from tqdm import tqdm
from realesrgan import RealESRGANe... | xinntao/Real-ESRGAN | 34,354 | Real-ESRGAN aims at developing Practical Algorithms for General Image/Video Restoration. | Python | xinntao | Xintao | Tencent |
realesrgan/__init__.py | Python | # flake8: noqa
from .archs import *
from .data import *
from .models import *
from .utils import *
from .version import *
| xinntao/Real-ESRGAN | 34,354 | Real-ESRGAN aims at developing Practical Algorithms for General Image/Video Restoration. | Python | xinntao | Xintao | Tencent |
realesrgan/archs/__init__.py | Python | import importlib
from basicsr.utils import scandir
from os import path as osp
# automatically scan and import arch modules for registry
# scan all the files that end with '_arch.py' under the archs folder
arch_folder = osp.dirname(osp.abspath(__file__))
arch_filenames = [osp.splitext(osp.basename(v))[0] for v in scand... | xinntao/Real-ESRGAN | 34,354 | Real-ESRGAN aims at developing Practical Algorithms for General Image/Video Restoration. | Python | xinntao | Xintao | Tencent |
realesrgan/archs/discriminator_arch.py | Python | from basicsr.utils.registry import ARCH_REGISTRY
from torch import nn as nn
from torch.nn import functional as F
from torch.nn.utils import spectral_norm
@ARCH_REGISTRY.register()
class UNetDiscriminatorSN(nn.Module):
"""Defines a U-Net discriminator with spectral normalization (SN)
It is used in Real-ESRGAN... | xinntao/Real-ESRGAN | 34,354 | Real-ESRGAN aims at developing Practical Algorithms for General Image/Video Restoration. | Python | xinntao | Xintao | Tencent |
realesrgan/archs/srvgg_arch.py | Python | from basicsr.utils.registry import ARCH_REGISTRY
from torch import nn as nn
from torch.nn import functional as F
@ARCH_REGISTRY.register()
class SRVGGNetCompact(nn.Module):
"""A compact VGG-style network structure for super-resolution.
It is a compact network structure, which performs upsampling in the last ... | xinntao/Real-ESRGAN | 34,354 | Real-ESRGAN aims at developing Practical Algorithms for General Image/Video Restoration. | Python | xinntao | Xintao | Tencent |
realesrgan/data/__init__.py | Python | import importlib
from basicsr.utils import scandir
from os import path as osp
# automatically scan and import dataset modules for registry
# scan all the files that end with '_dataset.py' under the data folder
data_folder = osp.dirname(osp.abspath(__file__))
dataset_filenames = [osp.splitext(osp.basename(v))[0] for v ... | xinntao/Real-ESRGAN | 34,354 | Real-ESRGAN aims at developing Practical Algorithms for General Image/Video Restoration. | Python | xinntao | Xintao | Tencent |
realesrgan/data/realesrgan_dataset.py | Python | import cv2
import math
import numpy as np
import os
import os.path as osp
import random
import time
import torch
from basicsr.data.degradations import circular_lowpass_kernel, random_mixed_kernels
from basicsr.data.transforms import augment
from basicsr.utils import FileClient, get_root_logger, imfrombytes, img2tensor
... | xinntao/Real-ESRGAN | 34,354 | Real-ESRGAN aims at developing Practical Algorithms for General Image/Video Restoration. | Python | xinntao | Xintao | Tencent |
realesrgan/data/realesrgan_paired_dataset.py | Python | import os
from basicsr.data.data_util import paired_paths_from_folder, paired_paths_from_lmdb
from basicsr.data.transforms import augment, paired_random_crop
from basicsr.utils import FileClient, imfrombytes, img2tensor
from basicsr.utils.registry import DATASET_REGISTRY
from torch.utils import data as data
from torchv... | xinntao/Real-ESRGAN | 34,354 | Real-ESRGAN aims at developing Practical Algorithms for General Image/Video Restoration. | Python | xinntao | Xintao | Tencent |
realesrgan/models/__init__.py | Python | import importlib
from basicsr.utils import scandir
from os import path as osp
# automatically scan and import model modules for registry
# scan all the files that end with '_model.py' under the model folder
model_folder = osp.dirname(osp.abspath(__file__))
model_filenames = [osp.splitext(osp.basename(v))[0] for v in s... | xinntao/Real-ESRGAN | 34,354 | Real-ESRGAN aims at developing Practical Algorithms for General Image/Video Restoration. | Python | xinntao | Xintao | Tencent |
realesrgan/models/realesrgan_model.py | Python | import numpy as np
import random
import torch
from basicsr.data.degradations import random_add_gaussian_noise_pt, random_add_poisson_noise_pt
from basicsr.data.transforms import paired_random_crop
from basicsr.models.srgan_model import SRGANModel
from basicsr.utils import DiffJPEG, USMSharp
from basicsr.utils.img_proce... | xinntao/Real-ESRGAN | 34,354 | Real-ESRGAN aims at developing Practical Algorithms for General Image/Video Restoration. | Python | xinntao | Xintao | Tencent |
realesrgan/models/realesrnet_model.py | Python | import numpy as np
import random
import torch
from basicsr.data.degradations import random_add_gaussian_noise_pt, random_add_poisson_noise_pt
from basicsr.data.transforms import paired_random_crop
from basicsr.models.sr_model import SRModel
from basicsr.utils import DiffJPEG, USMSharp
from basicsr.utils.img_process_uti... | xinntao/Real-ESRGAN | 34,354 | Real-ESRGAN aims at developing Practical Algorithms for General Image/Video Restoration. | Python | xinntao | Xintao | Tencent |
realesrgan/train.py | Python | # flake8: noqa
import os.path as osp
from basicsr.train import train_pipeline
import realesrgan.archs
import realesrgan.data
import realesrgan.models
if __name__ == '__main__':
root_path = osp.abspath(osp.join(__file__, osp.pardir, osp.pardir))
train_pipeline(root_path)
| xinntao/Real-ESRGAN | 34,354 | Real-ESRGAN aims at developing Practical Algorithms for General Image/Video Restoration. | Python | xinntao | Xintao | Tencent |
realesrgan/utils.py | Python | import cv2
import math
import numpy as np
import os
import queue
import threading
import torch
from basicsr.utils.download_util import load_file_from_url
from torch.nn import functional as F
ROOT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
class RealESRGANer():
"""A helper class for upsampl... | xinntao/Real-ESRGAN | 34,354 | Real-ESRGAN aims at developing Practical Algorithms for General Image/Video Restoration. | Python | xinntao | Xintao | Tencent |
scripts/extract_subimages.py | Python | import argparse
import cv2
import numpy as np
import os
import sys
from basicsr.utils import scandir
from multiprocessing import Pool
from os import path as osp
from tqdm import tqdm
def main(args):
"""A multi-thread tool to crop large images to sub-images for faster IO.
opt (dict): Configuration dict. It co... | xinntao/Real-ESRGAN | 34,354 | Real-ESRGAN aims at developing Practical Algorithms for General Image/Video Restoration. | Python | xinntao | Xintao | Tencent |
scripts/generate_meta_info.py | Python | import argparse
import cv2
import glob
import os
def main(args):
txt_file = open(args.meta_info, 'w')
for folder, root in zip(args.input, args.root):
img_paths = sorted(glob.glob(os.path.join(folder, '*')))
for img_path in img_paths:
status = True
if args.check:
... | xinntao/Real-ESRGAN | 34,354 | Real-ESRGAN aims at developing Practical Algorithms for General Image/Video Restoration. | Python | xinntao | Xintao | Tencent |
scripts/generate_meta_info_pairdata.py | Python | import argparse
import glob
import os
def main(args):
txt_file = open(args.meta_info, 'w')
# sca images
img_paths_gt = sorted(glob.glob(os.path.join(args.input[0], '*')))
img_paths_lq = sorted(glob.glob(os.path.join(args.input[1], '*')))
assert len(img_paths_gt) == len(img_paths_lq), ('GT folder ... | xinntao/Real-ESRGAN | 34,354 | Real-ESRGAN aims at developing Practical Algorithms for General Image/Video Restoration. | Python | xinntao | Xintao | Tencent |
scripts/generate_multiscale_DF2K.py | Python | import argparse
import glob
import os
from PIL import Image
def main(args):
# For DF2K, we consider the following three scales,
# and the smallest image whose shortest edge is 400
scale_list = [0.75, 0.5, 1 / 3]
shortest_edge = 400
path_list = sorted(glob.glob(os.path.join(args.input, '*')))
... | xinntao/Real-ESRGAN | 34,354 | Real-ESRGAN aims at developing Practical Algorithms for General Image/Video Restoration. | Python | xinntao | Xintao | Tencent |
scripts/pytorch2onnx.py | Python | import argparse
import torch
import torch.onnx
from basicsr.archs.rrdbnet_arch import RRDBNet
def main(args):
# An instance of the model
model = RRDBNet(num_in_ch=3, num_out_ch=3, num_feat=64, num_block=23, num_grow_ch=32, scale=4)
if args.params:
keyname = 'params'
else:
keyname = 'pa... | xinntao/Real-ESRGAN | 34,354 | Real-ESRGAN aims at developing Practical Algorithms for General Image/Video Restoration. | Python | xinntao | Xintao | Tencent |
setup.py | Python | #!/usr/bin/env python
from setuptools import find_packages, setup
import os
import subprocess
import time
version_file = 'realesrgan/version.py'
def readme():
with open('README.md', encoding='utf-8') as f:
content = f.read()
return content
def get_git_hash():
def _minimal_ext_cmd(cmd):
... | xinntao/Real-ESRGAN | 34,354 | Real-ESRGAN aims at developing Practical Algorithms for General Image/Video Restoration. | Python | xinntao | Xintao | Tencent |
tests/test_dataset.py | Python | import pytest
import yaml
from realesrgan.data.realesrgan_dataset import RealESRGANDataset
from realesrgan.data.realesrgan_paired_dataset import RealESRGANPairedDataset
def test_realesrgan_dataset():
with open('tests/data/test_realesrgan_dataset.yml', mode='r') as f:
opt = yaml.load(f, Loader=yaml.FullL... | xinntao/Real-ESRGAN | 34,354 | Real-ESRGAN aims at developing Practical Algorithms for General Image/Video Restoration. | Python | xinntao | Xintao | Tencent |
tests/test_discriminator_arch.py | Python | import torch
from realesrgan.archs.discriminator_arch import UNetDiscriminatorSN
def test_unetdiscriminatorsn():
"""Test arch: UNetDiscriminatorSN."""
# model init and forward (cpu)
net = UNetDiscriminatorSN(num_in_ch=3, num_feat=4, skip_connection=True)
img = torch.rand((1, 3, 32, 32), dtype=torch.... | xinntao/Real-ESRGAN | 34,354 | Real-ESRGAN aims at developing Practical Algorithms for General Image/Video Restoration. | Python | xinntao | Xintao | Tencent |
tests/test_model.py | Python | import torch
import yaml
from basicsr.archs.rrdbnet_arch import RRDBNet
from basicsr.data.paired_image_dataset import PairedImageDataset
from basicsr.losses.losses import GANLoss, L1Loss, PerceptualLoss
from realesrgan.archs.discriminator_arch import UNetDiscriminatorSN
from realesrgan.models.realesrgan_model import R... | xinntao/Real-ESRGAN | 34,354 | Real-ESRGAN aims at developing Practical Algorithms for General Image/Video Restoration. | Python | xinntao | Xintao | Tencent |
tests/test_utils.py | Python | import numpy as np
from basicsr.archs.rrdbnet_arch import RRDBNet
from realesrgan.utils import RealESRGANer
def test_realesrganer():
# initialize with default model
restorer = RealESRGANer(
scale=4,
model_path='experiments/pretrained_models/RealESRGAN_x4plus.pth',
model=None,
... | xinntao/Real-ESRGAN | 34,354 | Real-ESRGAN aims at developing Practical Algorithms for General Image/Video Restoration. | Python | xinntao | Xintao | Tencent |
facexlib/__init__.py | Python | # flake8: noqa
from .alignment import *
from .detection import *
from .recognition import *
from .tracking import *
from .utils import *
from .version import __gitsha__, __version__
from .visualization import *
| xinntao/facexlib | 963 | FaceXlib aims at providing ready-to-use face-related functions based on current STOA open-source methods. | Python | xinntao | Xintao | Tencent |
facexlib/alignment/__init__.py | Python | import torch
from facexlib.utils import load_file_from_url
from .awing_arch import FAN
from .convert_98_to_68_landmarks import landmark_98_to_68
__all__ = ['FAN', 'landmark_98_to_68']
def init_alignment_model(model_name, half=False, device='cuda', model_rootpath=None):
if model_name == 'awing_fan':
mode... | xinntao/facexlib | 963 | FaceXlib aims at providing ready-to-use face-related functions based on current STOA open-source methods. | Python | xinntao | Xintao | Tencent |
facexlib/alignment/awing_arch.py | Python | import cv2
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
def calculate_points(heatmaps):
# change heatmaps to landmarks
B, N, H, W = heatmaps.shape
HW = H * W
BN_range = np.arange(B * N)
heatline = heatmaps.reshape(B, N, HW)
indexes = np.argmax(heatline... | xinntao/facexlib | 963 | FaceXlib aims at providing ready-to-use face-related functions based on current STOA open-source methods. | Python | xinntao | Xintao | Tencent |
facexlib/alignment/convert_98_to_68_landmarks.py | Python | import numpy as np
def load_txt_file(file_path):
"""Load data or string from txt file."""
with open(file_path, 'r') as cfile:
content = cfile.readlines()
cfile.close()
content = [x.strip() for x in content]
num_lines = len(content)
return content, num_lines
def anno_parser(anno_path... | xinntao/facexlib | 963 | FaceXlib aims at providing ready-to-use face-related functions based on current STOA open-source methods. | Python | xinntao | Xintao | Tencent |
facexlib/assessment/__init__.py | Python | import torch
from facexlib.utils import load_file_from_url
from .hyperiqa_net import HyperIQA
def init_assessment_model(model_name, half=False, device='cuda', model_rootpath=None):
if model_name == 'hypernet':
model = HyperIQA(16, 112, 224, 112, 56, 28, 14, 7)
model_url = 'https://github.com/xinn... | xinntao/facexlib | 963 | FaceXlib aims at providing ready-to-use face-related functions based on current STOA open-source methods. | Python | xinntao | Xintao | Tencent |
facexlib/assessment/hyperiqa_net.py | Python | import torch as torch
import torch.nn as nn
from torch.nn import functional as F
class HyperIQA(nn.Module):
"""
Combine the hypernet and target network within a network.
"""
def __init__(self, *args):
super(HyperIQA, self).__init__()
self.hypernet = HyperNet(*args)
def forward(se... | xinntao/facexlib | 963 | FaceXlib aims at providing ready-to-use face-related functions based on current STOA open-source methods. | Python | xinntao | Xintao | Tencent |
facexlib/detection/__init__.py | Python | import torch
from copy import deepcopy
from facexlib.utils import load_file_from_url
from .retinaface import RetinaFace
def init_detection_model(model_name, half=False, device='cuda', model_rootpath=None):
if model_name == 'retinaface_resnet50':
model = RetinaFace(network_name='resnet50', half=half, devi... | xinntao/facexlib | 963 | FaceXlib aims at providing ready-to-use face-related functions based on current STOA open-source methods. | Python | xinntao | Xintao | Tencent |
facexlib/detection/align_trans.py | Python | import cv2
import numpy as np
from .matlab_cp2tform import get_similarity_transform_for_cv2
# reference facial points, a list of coordinates (x,y)
REFERENCE_FACIAL_POINTS = [[30.29459953, 51.69630051], [65.53179932, 51.50139999], [48.02519989, 71.73660278],
[33.54930115, 92.3655014], [62.72... | xinntao/facexlib | 963 | FaceXlib aims at providing ready-to-use face-related functions based on current STOA open-source methods. | Python | xinntao | Xintao | Tencent |
facexlib/detection/matlab_cp2tform.py | Python | import numpy as np
from numpy.linalg import inv, lstsq
from numpy.linalg import matrix_rank as rank
from numpy.linalg import norm
class MatlabCp2tormException(Exception):
def __str__(self):
return 'In File {}:{}'.format(__file__, super.__str__(self))
def tformfwd(trans, uv):
"""
Function:
-... | xinntao/facexlib | 963 | FaceXlib aims at providing ready-to-use face-related functions based on current STOA open-source methods. | Python | xinntao | Xintao | Tencent |
facexlib/detection/retinaface.py | Python | import cv2
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from PIL import Image
from torchvision.models._utils import IntermediateLayerGetter as IntermediateLayerGetter
from facexlib.detection.align_trans import get_reference_facial_points, warp_and_crop_face
from facexlib.detect... | xinntao/facexlib | 963 | FaceXlib aims at providing ready-to-use face-related functions based on current STOA open-source methods. | Python | xinntao | Xintao | Tencent |
facexlib/detection/retinaface_net.py | Python | import torch
import torch.nn as nn
import torch.nn.functional as F
def conv_bn(inp, oup, stride=1, leaky=0):
return nn.Sequential(
nn.Conv2d(inp, oup, 3, stride, 1, bias=False), nn.BatchNorm2d(oup),
nn.LeakyReLU(negative_slope=leaky, inplace=True))
def conv_bn_no_relu(inp, oup, stride):
retu... | xinntao/facexlib | 963 | FaceXlib aims at providing ready-to-use face-related functions based on current STOA open-source methods. | Python | xinntao | Xintao | Tencent |
facexlib/detection/retinaface_utils.py | Python | import numpy as np
import torch
import torchvision
from itertools import product as product
from math import ceil
class PriorBox(object):
def __init__(self, cfg, image_size=None, phase='train'):
super(PriorBox, self).__init__()
self.min_sizes = cfg['min_sizes']
self.steps = cfg['steps']
... | xinntao/facexlib | 963 | FaceXlib aims at providing ready-to-use face-related functions based on current STOA open-source methods. | Python | xinntao | Xintao | Tencent |
facexlib/headpose/__init__.py | Python | import torch
from facexlib.utils import load_file_from_url
from .hopenet_arch import HopeNet
def init_headpose_model(model_name, half=False, device='cuda', model_rootpath=None):
if model_name == 'hopenet':
model = HopeNet('resnet', [3, 4, 6, 3], 66)
model_url = 'https://github.com/xinntao/facexli... | xinntao/facexlib | 963 | FaceXlib aims at providing ready-to-use face-related functions based on current STOA open-source methods. | Python | xinntao | Xintao | Tencent |
facexlib/headpose/hopenet_arch.py | Python | import torch
import torch.nn as nn
import torchvision
class HopeNet(nn.Module):
# Hopenet with 3 output layers for yaw, pitch and roll
# Predicts Euler angles by binning and regression with the expected value
def __init__(self, block, layers, num_bins):
super(HopeNet, self).__init__()
if b... | xinntao/facexlib | 963 | FaceXlib aims at providing ready-to-use face-related functions based on current STOA open-source methods. | Python | xinntao | Xintao | Tencent |
facexlib/matting/__init__.py | Python | import torch
from copy import deepcopy
from facexlib.utils import load_file_from_url
from .modnet import MODNet
def init_matting_model(model_name='modnet', half=False, device='cuda', model_rootpath=None):
if model_name == 'modnet':
model = MODNet(backbone_pretrained=False)
model_url = 'https://gi... | xinntao/facexlib | 963 | FaceXlib aims at providing ready-to-use face-related functions based on current STOA open-source methods. | Python | xinntao | Xintao | Tencent |
facexlib/matting/backbone.py | Python | import os
import torch
import torch.nn as nn
from .mobilenetv2 import MobileNetV2
class BaseBackbone(nn.Module):
""" Superclass of Replaceable Backbone Model for Semantic Estimation
"""
def __init__(self, in_channels):
super(BaseBackbone, self).__init__()
self.in_channels = in_channels
... | xinntao/facexlib | 963 | FaceXlib aims at providing ready-to-use face-related functions based on current STOA open-source methods. | Python | xinntao | Xintao | Tencent |
facexlib/matting/mobilenetv2.py | Python | """ This file is adapted from https://github.com/thuyngch/Human-Segmentation-PyTorch"""
import math
import torch
from torch import nn
# ------------------------------------------------------------------------------
# Useful functions
# ------------------------------------------------------------------------------
... | xinntao/facexlib | 963 | FaceXlib aims at providing ready-to-use face-related functions based on current STOA open-source methods. | Python | xinntao | Xintao | Tencent |
facexlib/matting/modnet.py | Python | import torch
import torch.nn as nn
import torch.nn.functional as F
from .backbone import MobileNetV2Backbone
# ------------------------------------------------------------------------------
# MODNet Basic Modules
# ------------------------------------------------------------------------------
class IBNorm(nn.Modul... | xinntao/facexlib | 963 | FaceXlib aims at providing ready-to-use face-related functions based on current STOA open-source methods. | Python | xinntao | Xintao | Tencent |
facexlib/parsing/__init__.py | Python | import torch
from facexlib.utils import load_file_from_url
from .bisenet import BiSeNet
from .parsenet import ParseNet
def init_parsing_model(model_name='bisenet', half=False, device='cuda', model_rootpath=None):
if model_name == 'bisenet':
model = BiSeNet(num_class=19)
model_url = 'https://githu... | xinntao/facexlib | 963 | FaceXlib aims at providing ready-to-use face-related functions based on current STOA open-source methods. | Python | xinntao | Xintao | Tencent |
facexlib/parsing/bisenet.py | Python | import torch
import torch.nn as nn
import torch.nn.functional as F
from .resnet import ResNet18
class ConvBNReLU(nn.Module):
def __init__(self, in_chan, out_chan, ks=3, stride=1, padding=1):
super(ConvBNReLU, self).__init__()
self.conv = nn.Conv2d(in_chan, out_chan, kernel_size=ks, stride=stride... | xinntao/facexlib | 963 | FaceXlib aims at providing ready-to-use face-related functions based on current STOA open-source methods. | Python | xinntao | Xintao | Tencent |
facexlib/parsing/parsenet.py | Python | """Modified from https://github.com/chaofengc/PSFRGAN
"""
import numpy as np
import torch.nn as nn
from torch.nn import functional as F
class NormLayer(nn.Module):
"""Normalization Layers.
Args:
channels: input channels, for batch norm and instance norm.
input_size: input shape without batch ... | xinntao/facexlib | 963 | FaceXlib aims at providing ready-to-use face-related functions based on current STOA open-source methods. | Python | xinntao | Xintao | Tencent |
facexlib/parsing/resnet.py | Python | import torch.nn as nn
import torch.nn.functional as F
def conv3x3(in_planes, out_planes, stride=1):
"""3x3 convolution with padding"""
return nn.Conv2d(in_planes, out_planes, kernel_size=3, stride=stride, padding=1, bias=False)
class BasicBlock(nn.Module):
def __init__(self, in_chan, out_chan, stride=1... | xinntao/facexlib | 963 | FaceXlib aims at providing ready-to-use face-related functions based on current STOA open-source methods. | Python | xinntao | Xintao | Tencent |
facexlib/recognition/__init__.py | Python | import torch
from facexlib.utils import load_file_from_url
from .arcface_arch import Backbone
def init_recognition_model(model_name, half=False, device='cuda', model_rootpath=None):
if model_name == 'arcface':
model = Backbone(num_layers=50, drop_ratio=0.6, mode='ir_se').to('cuda').eval()
model_u... | xinntao/facexlib | 963 | FaceXlib aims at providing ready-to-use face-related functions based on current STOA open-source methods. | Python | xinntao | Xintao | Tencent |
facexlib/recognition/arcface_arch.py | Python | import torch
from collections import namedtuple
from torch.nn import (AdaptiveAvgPool2d, BatchNorm1d, BatchNorm2d, Conv2d, Dropout, Linear, MaxPool2d, Module, PReLU,
ReLU, Sequential, Sigmoid)
# Original Arcface Model
class Flatten(Module):
def forward(self, input):
return input.vi... | xinntao/facexlib | 963 | FaceXlib aims at providing ready-to-use face-related functions based on current STOA open-source methods. | Python | xinntao | Xintao | Tencent |
facexlib/tracking/data_association.py | Python | """
For each detected item, it computes the intersection over union (IOU) w.r.t.
each tracked object. (IOU matrix)
Then, it applies the Hungarian algorithm (via linear_assignment) to assign each
det. item to the best possible tracked item (i.e. to the one with max IOU)
"""
import numpy as np
from numba import jit
from... | xinntao/facexlib | 963 | FaceXlib aims at providing ready-to-use face-related functions based on current STOA open-source methods. | Python | xinntao | Xintao | Tencent |
facexlib/tracking/kalman_tracker.py | Python | import numpy as np
from filterpy.kalman import KalmanFilter
def convert_bbox_to_z(bbox):
"""Takes a bounding box in the form [x1,y1,x2,y2] and returns z in the form
[x,y,s,r] where x,y is the centre of the box and s is the scale/area and
r is the aspect ratio
"""
w = bbox[2] - bbox[0]
h = bbox... | xinntao/facexlib | 963 | FaceXlib aims at providing ready-to-use face-related functions based on current STOA open-source methods. | Python | xinntao | Xintao | Tencent |
facexlib/tracking/sort.py | Python | import numpy as np
from facexlib.tracking.data_association import associate_detections_to_trackers
from facexlib.tracking.kalman_tracker import KalmanBoxTracker
class SORT(object):
"""SORT: A Simple, Online and Realtime Tracker.
Ref: https://github.com/abewley/sort
"""
def __init__(self, max_age=1,... | xinntao/facexlib | 963 | FaceXlib aims at providing ready-to-use face-related functions based on current STOA open-source methods. | Python | xinntao | Xintao | Tencent |
facexlib/utils/__init__.py | Python | from .face_utils import align_crop_face_landmarks, compute_increased_bbox, get_valid_bboxes, paste_face_back
from .misc import img2tensor, load_file_from_url, scandir
__all__ = [
'align_crop_face_landmarks', 'compute_increased_bbox', 'get_valid_bboxes', 'load_file_from_url', 'paste_face_back',
'img2tensor', 's... | xinntao/facexlib | 963 | FaceXlib aims at providing ready-to-use face-related functions based on current STOA open-source methods. | Python | xinntao | Xintao | Tencent |
facexlib/utils/face_restoration_helper.py | Python | import cv2
import numpy as np
import os
import torch
from torchvision.transforms.functional import normalize
from facexlib.detection import init_detection_model
from facexlib.parsing import init_parsing_model
from facexlib.utils.misc import img2tensor, imwrite
def get_largest_face(det_faces, h, w):
def get_loca... | xinntao/facexlib | 963 | FaceXlib aims at providing ready-to-use face-related functions based on current STOA open-source methods. | Python | xinntao | Xintao | Tencent |
facexlib/utils/face_utils.py | Python | import cv2
import numpy as np
import torch
def compute_increased_bbox(bbox, increase_area, preserve_aspect=True):
left, top, right, bot = bbox
width = right - left
height = bot - top
if preserve_aspect:
width_increase = max(increase_area, ((1 + 2 * increase_area) * height - width) / (2 * widt... | xinntao/facexlib | 963 | FaceXlib aims at providing ready-to-use face-related functions based on current STOA open-source methods. | Python | xinntao | Xintao | Tencent |
facexlib/utils/misc.py | Python | import cv2
import os
import os.path as osp
import torch
from torch.hub import download_url_to_file, get_dir
from urllib.parse import urlparse
ROOT_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
def imwrite(img, file_path, params=None, auto_mkdir=True):
"""Write image to file.
... | xinntao/facexlib | 963 | FaceXlib aims at providing ready-to-use face-related functions based on current STOA open-source methods. | Python | xinntao | Xintao | Tencent |
facexlib/visualization/__init__.py | Python | from .vis_alignment import visualize_alignment
from .vis_detection import visualize_detection
from .vis_headpose import visualize_headpose
__all__ = ['visualize_detection', 'visualize_alignment', 'visualize_headpose']
| xinntao/facexlib | 963 | FaceXlib aims at providing ready-to-use face-related functions based on current STOA open-source methods. | Python | xinntao | Xintao | Tencent |
facexlib/visualization/vis_alignment.py | Python | import cv2
import numpy as np
def visualize_alignment(img, landmarks, save_path=None, to_bgr=False):
img = np.copy(img)
h, w = img.shape[0:2]
circle_size = int(max(h, w) / 150)
if to_bgr:
img = cv2.cvtColor(img, cv2.COLOR_RGB2BGR)
for landmarks_face in landmarks:
for lm in landmar... | xinntao/facexlib | 963 | FaceXlib aims at providing ready-to-use face-related functions based on current STOA open-source methods. | Python | xinntao | Xintao | Tencent |
facexlib/visualization/vis_detection.py | Python | import cv2
import numpy as np
def visualize_detection(img, bboxes_and_landmarks, save_path=None, to_bgr=False):
"""Visualize detection results.
Args:
img (Numpy array): Input image. CHW, BGR, [0, 255], uint8.
"""
img = np.copy(img)
if to_bgr:
img = cv2.cvtColor(img, cv2.COLOR_RGB2... | xinntao/facexlib | 963 | FaceXlib aims at providing ready-to-use face-related functions based on current STOA open-source methods. | Python | xinntao | Xintao | Tencent |
facexlib/visualization/vis_headpose.py | Python | import cv2
import numpy as np
from math import cos, sin
def draw_axis(img, yaw, pitch, roll, tdx=None, tdy=None, size=100):
"""draw head pose axis."""
pitch = pitch * np.pi / 180
yaw = -yaw * np.pi / 180
roll = roll * np.pi / 180
if tdx is None or tdy is None:
height, width = img.shape[:... | xinntao/facexlib | 963 | FaceXlib aims at providing ready-to-use face-related functions based on current STOA open-source methods. | Python | xinntao | Xintao | Tencent |
inference/inference_alignment.py | Python | import argparse
import cv2
import torch
from facexlib.alignment import init_alignment_model, landmark_98_to_68
from facexlib.visualization import visualize_alignment
def main(args):
# initialize model
align_net = init_alignment_model(args.model_name, device=args.device)
img = cv2.imread(args.img_path)
... | xinntao/facexlib | 963 | FaceXlib aims at providing ready-to-use face-related functions based on current STOA open-source methods. | Python | xinntao | Xintao | Tencent |
inference/inference_crop_standard_faces.py | Python | import cv2
import torch
from facexlib.detection import init_detection_model
from facexlib.utils.face_restoration_helper import FaceRestoreHelper
input_img = '/home/wxt/datasets/ffhq/ffhq_wild/00028.png'
# initialize face helper
face_helper = FaceRestoreHelper(
upscale_factor=1, face_size=512, crop_ratio=(1, 1), d... | xinntao/facexlib | 963 | FaceXlib aims at providing ready-to-use face-related functions based on current STOA open-source methods. | Python | xinntao | Xintao | Tencent |
inference/inference_detection.py | Python | import argparse
import cv2
import torch
from facexlib.detection import init_detection_model
from facexlib.visualization import visualize_detection
def main(args):
# initialize model
det_net = init_detection_model(args.model_name, half=args.half)
img = cv2.imread(args.img_path)
with torch.no_grad():
... | xinntao/facexlib | 963 | FaceXlib aims at providing ready-to-use face-related functions based on current STOA open-source methods. | Python | xinntao | Xintao | Tencent |
inference/inference_headpose.py | Python | import argparse
import cv2
import numpy as np
import torch
from torchvision.transforms.functional import normalize
from facexlib.detection import init_detection_model
from facexlib.headpose import init_headpose_model
from facexlib.utils.misc import img2tensor
from facexlib.visualization import visualize_headpose
def... | xinntao/facexlib | 963 | FaceXlib aims at providing ready-to-use face-related functions based on current STOA open-source methods. | Python | xinntao | Xintao | Tencent |
inference/inference_hyperiqa.py | Python | import argparse
import cv2
import numpy as np
import os
import torch
import torchvision
from PIL import Image
from facexlib.assessment import init_assessment_model
from facexlib.detection import init_detection_model
def main(args):
"""Scripts about evaluating face quality.
Two steps:
1) detect th... | xinntao/facexlib | 963 | FaceXlib aims at providing ready-to-use face-related functions based on current STOA open-source methods. | Python | xinntao | Xintao | Tencent |
inference/inference_matting.py | Python | import argparse
import cv2
import numpy as np
import torch.nn.functional as F
from torchvision.transforms.functional import normalize
from facexlib.matting import init_matting_model
from facexlib.utils import img2tensor
def main(args):
modnet = init_matting_model()
# read image
img = cv2.imread(args.img... | xinntao/facexlib | 963 | FaceXlib aims at providing ready-to-use face-related functions based on current STOA open-source methods. | Python | xinntao | Xintao | Tencent |
inference/inference_parsing.py | Python | import argparse
import cv2
import numpy as np
import os
import torch
from torchvision.transforms.functional import normalize
from facexlib.parsing import init_parsing_model
from facexlib.utils.misc import img2tensor
def vis_parsing_maps(img, parsing_anno, stride, save_anno_path=None, save_vis_path=None):
# Color... | xinntao/facexlib | 963 | FaceXlib aims at providing ready-to-use face-related functions based on current STOA open-source methods. | Python | xinntao | Xintao | Tencent |
inference/inference_parsing_parsenet.py | Python | import argparse
import cv2
import numpy as np
import os
import torch
from torchvision.transforms.functional import normalize
from facexlib.parsing import init_parsing_model
from facexlib.utils.misc import img2tensor
def vis_parsing_maps(img, parsing_anno, stride, save_anno_path=None, save_vis_path=None):
# Color... | xinntao/facexlib | 963 | FaceXlib aims at providing ready-to-use face-related functions based on current STOA open-source methods. | Python | xinntao | Xintao | Tencent |
inference/inference_recognition.py | Python | import argparse
import glob
import math
import numpy as np
import os
import torch
from facexlib.recognition import ResNetArcFace, cosin_metric, load_image
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('--folder1', type=str)
parser.add_argument('--folder2', type=str)
... | xinntao/facexlib | 963 | FaceXlib aims at providing ready-to-use face-related functions based on current STOA open-source methods. | Python | xinntao | Xintao | Tencent |
inference/inference_tracking.py | Python | import argparse
import cv2
import glob
import numpy as np
import os
import torch
from tqdm import tqdm
from facexlib.detection import init_detection_model
from facexlib.tracking.sort import SORT
def main(args):
detect_interval = args.detect_interval
margin = args.margin
face_score_threshold = args.face_s... | xinntao/facexlib | 963 | FaceXlib aims at providing ready-to-use face-related functions based on current STOA open-source methods. | Python | xinntao | Xintao | Tencent |
scripts/crop_faces_5landmarks.py | Python | import glob
import os
import facexlib.utils.face_restoration_helper as face_restoration_helper
def crop_one_img(img, save_cropped_path=None):
FaceRestoreHelper.clean_all()
FaceRestoreHelper.read_image(img)
# get face landmarks
FaceRestoreHelper.get_face_landmarks_5()
FaceRestoreHelper.align_warp_... | xinntao/facexlib | 963 | FaceXlib aims at providing ready-to-use face-related functions based on current STOA open-source methods. | Python | xinntao | Xintao | Tencent |
scripts/extract_detection_info_ffhq.py | Python | import cv2
import glob
import numpy as np
import os
import torch
from PIL import Image
from tqdm import tqdm
from facexlib.detection import init_detection_model
def draw_and_save(image, bboxes_and_landmarks, save_path, order_type=1):
"""Visualize results
"""
if isinstance(image, Image.Image):
ima... | xinntao/facexlib | 963 | FaceXlib aims at providing ready-to-use face-related functions based on current STOA open-source methods. | Python | xinntao | Xintao | Tencent |
scripts/get_ffhq_template.py | Python | import cv2
import numpy as np
from PIL import Image
bboxes = np.load('ffhq_det_info.npy', allow_pickle=True)
bboxes = np.array(bboxes).squeeze(1)
bboxes = np.mean(bboxes, axis=0)
print(bboxes)
def draw_and_save(image, bboxes_and_landmarks, save_path, order_type=1):
"""Visualize results
"""
if isinstan... | xinntao/facexlib | 963 | FaceXlib aims at providing ready-to-use face-related functions based on current STOA open-source methods. | Python | xinntao | Xintao | Tencent |
setup.py | Python | #!/usr/bin/env python
from setuptools import find_packages, setup
import os
import subprocess
import time
version_file = 'facexlib/version.py'
def readme():
with open('README.md', encoding='utf-8') as f:
content = f.read()
return content
def get_git_hash():
def _minimal_ext_cmd(cmd):
... | xinntao/facexlib | 963 | FaceXlib aims at providing ready-to-use face-related functions based on current STOA open-source methods. | Python | xinntao | Xintao | Tencent |
__tests__/parse.test.ts | TypeScript | import { expect, test } from '@jest/globals'
import parse from '../src/parse'
test('parse', () => {
expect(parse('')).toMatchSnapshot()
expect(parse('cmd')).toMatchSnapshot()
expect(parse('/bot')).toMatchSnapshot()
expect(parse('/bot cmd')).toMatchSnapshot()
expect(parse('/bot cmd a b c')).toMatchSnapshot()
... | xlc/fellowship-process-bot | 0 | TypeScript | xlc | Xiliang Chen | Laminar | |
__tests__/process.test.ts | TypeScript | import * as github from '@actions/github'
import { expect, test } from '@jest/globals'
import { config } from 'dotenv'
import processCmd from '../src/process'
config()
test('processCmd', async () => {
const ctx = {
owner: 'xlc',
repo: 'RFCs',
issue_number: 14
}
const octokit = github.getOctokit(pro... | xlc/fellowship-process-bot | 0 | TypeScript | xlc | Xiliang Chen | Laminar | |
jest.config.js | JavaScript | module.exports = {
clearMocks: true,
moduleFileExtensions: ['js', 'ts'],
testMatch: ['**/*.test.ts'],
transform: {
'^.+\\.ts$': 'ts-jest'
},
verbose: true
} | xlc/fellowship-process-bot | 0 | TypeScript | xlc | Xiliang Chen | Laminar | |
src/api.ts | TypeScript | import { ScProvider } from '@polkadot/rpc-provider/substrate-connect'
import { ApiPromise, WsProvider } from '@polkadot/api'
import * as SC from '@substrate/connect'
import collectivesChainspec from './chainspecs/collectives-polkadot.json'
export const create = async () => {
const endpoint = process.env.ENDPOINT || ... | xlc/fellowship-process-bot | 0 | TypeScript | xlc | Xiliang Chen | Laminar | |
src/main.ts | TypeScript | import * as github from '@actions/github'
import processCmd from './process'
const main = async () => {
const rawcmd: string = github.context.payload.comment?.body
if (!rawcmd) {
console.log('No comment body found')
return
}
const githubToken = process.env.GH_TOKEN
const PAT = process.env.GH_PAT ||... | xlc/fellowship-process-bot | 0 | TypeScript | xlc | Xiliang Chen | Laminar | |
src/parse.ts | TypeScript | const parse = (body: string) => {
const match = body.match(/\/bot\s+(\w+)(.*)/)
if (!match) {
return {
getArg: () => undefined
}
}
const [, cmd, args] = match
// use csv parser to handle quoted strings
const argsArr: string[] = args.trim().split(/\s+/)
const namedArgs: Record<string, stri... | xlc/fellowship-process-bot | 0 | TypeScript | xlc | Xiliang Chen | Laminar | |
src/process.ts | TypeScript | import * as github from '@actions/github'
import { blake2AsHex } from '@polkadot/util-crypto'
import '@polkadot/api/augment'
import parse from './parse'
import { create } from './api'
type Context = {
owner: string
repo: string
issue_number: number
}
const processCmd = async (octokit: ReturnType<typeof github.... | xlc/fellowship-process-bot | 0 | TypeScript | xlc | Xiliang Chen | Laminar | |
serde-implicit-proc/src/ast.rs | Rust | use std::collections::HashSet;
use syn::{
DeriveInput, Error, Field, FieldsNamed, FieldsUnnamed, Generics, Ident, punctuated::Punctuated,
token::Comma,
};
pub struct Variant {
pub ident: Ident,
pub tag: Ident,
pub fields: FieldsNamed,
}
pub struct TupleVariant {
pub ident: Ident,
pub fiel... | xldenis/serde-implicit | 2 | implicitly tagged enum representation for serde | Rust | xldenis | Xavier Denis | turbopuffer |
serde-implicit-proc/src/expand.rs | Rust | use annoying::{ImplGenerics, TypeGenerics};
use proc_macro2::{Literal, TokenStream};
use quote::{format_ident, quote};
use syn::{Ident, WhereClause};
use crate::{
ast::{self, Fallthrough, Style},
tuple_enum::expand_tuple_enum,
};
pub fn expand_derive_serialize(input: syn::DeriveInput) -> syn::Result<proc_macr... | xldenis/serde-implicit | 2 | implicitly tagged enum representation for serde | Rust | xldenis | Xavier Denis | turbopuffer |
serde-implicit-proc/src/lib.rs | Rust | use proc_macro::TokenStream as TS1;
use syn::{DeriveInput, parse_macro_input};
mod ast;
mod expand;
mod tuple_enum;
/// Derive macro for implicitly tagged enum deserialization.
///
/// Annotate one field per variant with `#[serde_implicit(tag)]` to mark it as
/// the discriminant. When that key appears in the input, ... | xldenis/serde-implicit | 2 | implicitly tagged enum representation for serde | Rust | xldenis | Xavier Denis | turbopuffer |
serde-implicit-proc/src/tuple_enum.rs | Rust | use quote::{format_ident, quote};
use syn::Ident;
use crate::ast::{self};
pub fn expand_tuple_enum(
ty_name: &Ident,
variants: &[ast::TupleVariant],
) -> syn::Result<proc_macro2::TokenStream> {
// Separate variants into regular and flatten groups
let (regular_variants, flatten_variants): (Vec<_>, Vec<... | xldenis/serde-implicit | 2 | implicitly tagged enum representation for serde | Rust | xldenis | Xavier Denis | turbopuffer |
serde-implicit/src/content.rs | Rust | // This module is private and nothing here should be used outside of
// generated code.
//
// We will iterate on the implementation for a few releases and only have to
// worry about backward compatibility for the `untagged` and `tag` attributes
// rather than for this entire mechanism.
//
// This issue is tracking mak... | xldenis/serde-implicit | 2 | implicitly tagged enum representation for serde | Rust | xldenis | Xavier Denis | turbopuffer |
serde-implicit/src/lib.rs | Rust | pub use serde_implicit_proc::Deserialize;
#[doc(hidden)]
#[path = "private.rs"]
pub mod __private;
pub mod content;
| xldenis/serde-implicit | 2 | implicitly tagged enum representation for serde | Rust | xldenis | Xavier Denis | turbopuffer |
serde-implicit/src/private.rs | Rust | use std::fmt;
use std::marker::PhantomData;
use serde::de::{self, IntoDeserializer, MapAccess, Unexpected};
use serde::forward_to_deserialize_any;
use serde::{Deserialize, de::Visitor};
pub use crate::content::{Content, ContentDeserializer, ContentRefDeserializer};
pub struct TaggedContentVisitor<T> {
expecting:... | xldenis/serde-implicit | 2 | implicitly tagged enum representation for serde | Rust | xldenis | Xavier Denis | turbopuffer |
serde-implicit/tests/dummy.rs | Rust | use serde_json::json;
#[test]
fn test_basic() {
#[allow(dead_code)]
#[derive(serde_implicit_proc::Deserialize, Debug)]
// #[serde(untagged)]
enum MultiTypeTag {
StringVariant {
#[serde_implicit(tag)]
string_tag: String,
value: u32,
},
NumberVa... | xldenis/serde-implicit | 2 | implicitly tagged enum representation for serde | Rust | xldenis | Xavier Denis | turbopuffer |
serde-implicit/tests/proptest.rs | Rust | use arbitrary_json::ArbitraryValue;
use proptest::prelude::*;
use proptest::proptest;
use proptest_arbitrary_interop::arb;
use proptest_derive::Arbitrary;
#[derive(serde_implicit_proc::Deserialize, serde::Serialize, Debug, PartialEq, Arbitrary)]
#[serde(untagged)]
enum MultiTypeTag {
StringVariant {
#[serd... | xldenis/serde-implicit | 2 | implicitly tagged enum representation for serde | Rust | xldenis | Xavier Denis | turbopuffer |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.