This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # nunif/iw3 extension for Sapiens2: https://github.com/facebookresearch/sapiens2 | |
| # | |
| # Sapiens2 is a suite of human-centric vision models that includes depth estimation and segmentation, | |
| # allowing the creation of passthrough 3D videos with only people extracted from standard video footage. | |
| # | |
| # Save this file as `iw3/depth_models/_sapiens2_model.py`. | |
| # Checkpoint files (pointmap and seg) can be downloaded from: https://huggingface.co/collections/facebook/sapiens2 | |
| # Example: | |
| # iw3/pretrained_models/hub/checkpoints/sapiens2_0.4b_pointmap.safetensors | |
| # iw3/pretrained_models/hub/checkpoints/sapiens2_0.4b_seg.safetensors |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import ctypes | |
| import os | |
| import sys | |
| import torch | |
| import numpy as np | |
| import torchvision | |
| # NVOF Constants | |
| NV_OF_API_MAJOR_VERSION = 2 | |
| NV_OF_API_MINOR_VERSION = 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import torch | |
| import coremltools as ct | |
| import os | |
| # --- Model Definitions (Primary Models) --- | |
| V2_MODELS = { | |
| # model_name: (entry_point, arg_name, encoder_name) | |
| "Any_S": ("DepthAnything", "encoder", "vits"), | |
| "Any_B": ("DepthAnything", "encoder", "vitb"), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # python generate_person_mask_sam3.py -i ./test_images -o output | |
| # | |
| # This script generates human masks from images. | |
| # It works not only with photos but also with anime-style images. | |
| # The latest version of transformers is required. | |
| # `pip install git+https://github.com/huggingface/transformers.git` | |
| # Using SAM3 requires proper license authorization. | |
| import os | |
| from os import path |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #version 450 | |
| layout (location = POSITION) in vec3 aVertexPosition; | |
| layout (location = TEXCOORD0) in vec2 aVertexTextureCoord; | |
| layout (location = TEXCOORD0) out vec2 vTexCoord; | |
| void main() { | |
| vTexCoord = aVertexTextureCoord; | |
| gl_Position = vec4(aVertexPosition, 1); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| export NODE_OPTIONS="" | |
| git submodule sync --recursive | |
| git submodule update --init --recursive | |
| BUILD_DIR=build_jsep_st | |
| rm -fr ${BUILD_DIR} | |
| cd cmake/external/emsdk |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import numpy as np | |
| from timeit import timeit | |
| from collections import deque | |
| # online running meanstd. ref https://github.com/ajcr/rolling/tree/master/rolling | |
| class TimeRunningMeanStd(object): | |
| def __init__(self, shape, ttl): | |
| self.ttl = ttl | |
| self.mean = np.zeros(shape, dtype=np.float64) | |
| self.std = np.ones(shape, dtype=np.float64) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'nn' | |
| local ScaleTable, parent = torch.class("nn.ScaleTable", "nn.Module") | |
| function ScaleTable:__init() | |
| parent.__init(self) | |
| self.gradInput = {} | |
| self.grad_tmp = torch.Tensor() | |
| self.scale = torch.Tensor() | |
| end | |
| function ScaleTable:updateOutput(input) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # pip3 install python-dateutil websocket-client | |
| import sys | |
| import time | |
| import json | |
| import websocket | |
| from dateutil.parser import parse as date_parse | |
| from collections import deque | |
| K=100 | |
| pack_buf = deque(maxlen=K) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # -*- coding: utf-8 -*- | |
| # pip3 install xlrd python-dateutil | |
| import xlrd | |
| from datetime import datetime | |
| from dateutil.parser import parse as date_parse | |
| from collections import defaultdict | |
| # 入力ファイル |
NewerOlder