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 |
|---|---|---|---|---|---|---|---|---|---|
tests/resolvers/test_gitlab.py | Python | import pytest
from yarl import URL
from repoproviders.resolvers.base import MaybeExists
from repoproviders.resolvers.git import Git, GitLabResolver
from repoproviders.resolvers.repos import GitLabURL
@pytest.mark.parametrize(
("url", "expected"),
(
# GitLab URLs that are not repos
(
... | yuvipanda/repoproviders | 1 | Detect, resolve and fetch repositories of content | Python | yuvipanda | Yuvi | 2i2c-org |
tests/resolvers/test_giturl.py | Python | import pytest
from yarl import URL
from repoproviders.resolvers.base import MaybeExists
from repoproviders.resolvers.git import Git, GitUrlResolver
@pytest.mark.parametrize(
("url", "expected"),
(
# Not a git url
("https://example.com/something", None),
# Not a real repo, but looks li... | yuvipanda/repoproviders | 1 | Detect, resolve and fetch repositories of content | Python | yuvipanda | Yuvi | 2i2c-org |
tests/resolvers/test_google_drive.py | Python | import pytest
from repoproviders.resolvers.base import DoesNotExist, Exists
from repoproviders.resolvers.rclone import (
GoogleDriveFolder,
GoogleDriveFolderResolver,
ImmutableGoogleDriveFolder,
)
@pytest.mark.parametrize(
("url", "expected"),
(
# Immutable directory
(
... | yuvipanda/repoproviders | 1 | Detect, resolve and fetch repositories of content | Python | yuvipanda | Yuvi | 2i2c-org |
tests/resolvers/test_immutablegit.py | Python | from logging import Logger
import pytest
from repoproviders.resolvers.base import DoesNotExist, Exists, MaybeExists
from repoproviders.resolvers.git import Git, ImmutableGit, ImmutableGitResolver
@pytest.mark.parametrize(
("question", "expected"),
(
# Random URL, not a git repo
(
... | yuvipanda/repoproviders | 1 | Detect, resolve and fetch repositories of content | Python | yuvipanda | Yuvi | 2i2c-org |
tests/resolvers/test_resolve.py | Python | import pytest
from yarl import URL
from repoproviders.resolvers import resolve
from repoproviders.resolvers.base import DoesNotExist, Exists, MaybeExists
from repoproviders.resolvers.repos import (
DataverseDataset,
DataverseURL,
Doi,
FigshareDataset,
FigshareInstallation,
FigshareURL,
Gist... | yuvipanda/repoproviders | 1 | Detect, resolve and fetch repositories of content | Python | yuvipanda | Yuvi | 2i2c-org |
tests/resolvers/test_serialize.py | Python | import json
import pytest
from repoproviders import resolve
from repoproviders.resolvers.serialize import to_json
@pytest.mark.parametrize(
("url", "expected"),
(
("https://example.com", None),
(
"https://github.com/pyOpenSci",
{
"certainity": "MaybeEx... | yuvipanda/repoproviders | 1 | Detect, resolve and fetch repositories of content | Python | yuvipanda | Yuvi | 2i2c-org |
tests/resolvers/test_wellknown.py | Python | import pytest
from yarl import URL
from repoproviders.resolvers.base import MaybeExists
from repoproviders.resolvers.rclone import GoogleDriveFolder
from repoproviders.resolvers.repos import (
DataverseURL,
Doi,
FigshareInstallation,
FigshareURL,
GistURL,
GitHubURL,
GitLabURL,
Hydroshar... | yuvipanda/repoproviders | 1 | Detect, resolve and fetch repositories of content | Python | yuvipanda | Yuvi | 2i2c-org |
tests/resolvers/test_zenodo.py | Python | import pytest
from yarl import URL
from repoproviders.resolvers.base import DoesNotExist, MaybeExists
from repoproviders.resolvers.doi import ZenodoResolver
from repoproviders.resolvers.repos import ZenodoDataset, ZenodoURL
@pytest.mark.parametrize(
("url", "expected"),
(
# A valid Zenodo URL that is... | yuvipanda/repoproviders | 1 | Detect, resolve and fetch repositories of content | Python | yuvipanda | Yuvi | 2i2c-org |
tests/test_utils.py | Python | import asyncio
import secrets
import socket
import sys
import tempfile
from logging import Logger
from pathlib import Path
import aiohttp
from yarl import URL
from repoproviders.utils import download_file
def random_port() -> int:
"""
Get a single random port that is *probably* unused
"""
sock = soc... | yuvipanda/repoproviders | 1 | Detect, resolve and fetch repositories of content | Python | yuvipanda | Yuvi | 2i2c-org |
src/ruamelfmt/__main__.py | Python | import argparse
import sys
from ruamel.yaml import YAML
from ruamel.yaml.constructor import DuplicateKeyError
from ruamel.yaml.scanner import ScannerError
def main():
parser = argparse.ArgumentParser()
parser.add_argument('--line-length', default=sys.maxsize, type=int)
parser.add_argument('filepath', nargs... | yuvipanda/ruamelfmt | 2 | Autoformat YAML files as ruamel.yaml does | Python | yuvipanda | Yuvi | 2i2c-org |
tests/system/test_import.py | Python | # Copyright (c) 2024 Yuvi
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
# ... | yuvipanda/ruamelfmt | 2 | Autoformat YAML files as ruamel.yaml does | Python | yuvipanda | Yuvi | 2i2c-org |
src/Setup.lhs | Haskell | This file was generated by `cargo-cabal`, its goal is to define few hooks to
call `cargo` on the fly and link correctly the generated library.
While it's an acceptable hack as this project is currently a prototype, this
should be removed before `cargo-cabal` stable release.
> import Data.Maybe
> import qualified Dist... | yvan-sraka/cargo-cabal | 109 | A tool that helps you to turn in one command a Rust crate into a Haskell Cabal library! | Rust | yvan-sraka | Yvan Sraka | |
src/build.rs | Rust | //! Support to dynamic library, require in user crate a small `build.rs` script,
//! that link to generated Rust library a filename with GHC version suffix, e.g.
//! `libNAME-ghcVERSION.so`, `libNAME-ghcVERSION.dylib` or `NAME-ghcVERSION.dll`
//!
//! Version is the one of `ghc` in `$PATH`, but could be overide with
//!... | yvan-sraka/cargo-cabal | 109 | A tool that helps you to turn in one command a Rust crate into a Haskell Cabal library! | Rust | yvan-sraka | Yvan Sraka | |
src/cabal.rs | Rust | /// Generate user `.cabal`, taking `--enable-nix` option into account
pub(crate) fn generate(name: &str, module: &str, version: &str, enable_nix: bool) -> String {
let build_type = if enable_nix {
"
build-type: Simple"
} else {
"
-- This let us hook Cabal steps to Setup.lhs script.
build... | yvan-sraka/cargo-cabal | 109 | A tool that helps you to turn in one command a Rust crate into a Haskell Cabal library! | Rust | yvan-sraka | Yvan Sraka | |
src/cargo.rs | Rust | //! This module defines data-structure into which user `Cargo.toml` is parsed
use serde::Deserialize;
#[derive(Clone, Deserialize)]
pub(crate) struct Root {
pub(crate) package: Option<Package>,
pub(crate) lib: Option<Lib>,
}
#[derive(Clone, Deserialize)]
pub(crate) struct Package {
pub(crate) name: Optio... | yvan-sraka/cargo-cabal | 109 | A tool that helps you to turn in one command a Rust crate into a Haskell Cabal library! | Rust | yvan-sraka | Yvan Sraka | |
src/errors.rs | Rust | use displaydoc::Display;
use thiserror::Error;
/// CLI errors displayed by `cargo-cabal` to help end-users to set up correctly
/// their Rust project!
#[derive(Display, Error, Debug)]
pub enum Error {
/** Fail to read content of `Cargo.toml` file
* n.b. you have to run the command from the root folder of you... | yvan-sraka/cargo-cabal | 109 | A tool that helps you to turn in one command a Rust crate into a Haskell Cabal library! | Rust | yvan-sraka | Yvan Sraka | |
src/flake.rs | Rust | /// Generate content of a `flake.nix` using `haskell.nix` and `naersk` and which
/// is a good alternative to hacking with a custom `Setup.lhs`! This file is
/// generated by the `--enable-nix` CLI option.
pub(crate) fn generate(name: &str) -> String {
format!(
"{{
inputs = {{
haskell-nix.url = \"gith... | yvan-sraka/cargo-cabal | 109 | A tool that helps you to turn in one command a Rust crate into a Haskell Cabal library! | Rust | yvan-sraka | Yvan Sraka | |
src/hsbindgen.rs | Rust | // FIXME: rather than living in this custom file, these options could be moved
// under an `[hs-bindgen]` manifest key directly in `Cargo.toml` (even if this
// would trigger a `unused manifest key` warning at `cargo build`)?
const VERSION: &str = "0.8.0";
/// Generate content of `hsbindgen.toml` file, a neat way to ... | yvan-sraka/cargo-cabal | 109 | A tool that helps you to turn in one command a Rust crate into a Haskell Cabal library! | Rust | yvan-sraka | Yvan Sraka | |
src/lib.rs | Rust | mod cabal;
mod cargo;
#[macro_use]
mod errors;
mod flake;
mod hsbindgen;
use cargo::{get_crate_type, CrateType};
use clap::{arg, Parser, Subcommand};
use errors::Error;
use std::{fs, path::Path};
/// A tool that helps you to turn in one command a Rust crate into a Haskell Cabal library
#[derive(Parser)]
#[command(ver... | yvan-sraka/cargo-cabal | 109 | A tool that helps you to turn in one command a Rust crate into a Haskell Cabal library! | Rust | yvan-sraka | Yvan Sraka | |
src/main.rs | Rust | //! # `cargo-cabal`
//!
//! A tool that helps you to turn in one command a Rust crate into a Haskell
//! Cabal library!
//!
//! To generate bindings, you need to annotate the Rust function you want to
//! expose with [`hs-bindgen`](https://github.com/yvan-sraka/hs-bindgen) macro.
//!
//! ## Getting started
//!
//! Here... | yvan-sraka/cargo-cabal | 109 | A tool that helps you to turn in one command a Rust crate into a Haskell Cabal library! | Rust | yvan-sraka | Yvan Sraka | |
tests/greetings/src/lib.rs | Rust | use hs_bindgen::*;
#[hs_bindgen]
fn hello(name: &str) {
println!("Hello, {name}!");
}
| yvan-sraka/cargo-cabal | 109 | A tool that helps you to turn in one command a Rust crate into a Haskell Cabal library! | Rust | yvan-sraka | Yvan Sraka | |
tests/haskell-nix.sh | Shell | #! /usr/bin/env nix-shell
#! nix-shell -i bash -p cargo rustc
set -euxo pipefail
pushd greetings
cargo add hs-bindgen --features full
../../result/bin/cargo-cabal cabal init --overwrite --enable-nix
git add flake.nix
nix build
| yvan-sraka/cargo-cabal | 109 | A tool that helps you to turn in one command a Rust crate into a Haskell Cabal library! | Rust | yvan-sraka | Yvan Sraka | |
tests/simple.sh | Shell | #! /usr/bin/env nix-shell
#! nix-shell -i bash -p cargo rustc cabal-install ghc
set -euxo pipefail
pushd greetings
cargo clean
cargo add hs-bindgen --features full
../../result/bin/cargo-cabal cabal init --overwrite
cargo build
popd
cabal clean
cabal run test
| yvan-sraka/cargo-cabal | 109 | A tool that helps you to turn in one command a Rust crate into a Haskell Cabal library! | Rust | yvan-sraka | Yvan Sraka | |
tests/test/app/Main.hs | Haskell | module Main where
import Foreign.C.String
import Greetings
main :: IO ()
main = withCString "Rust 🦀" hello
| yvan-sraka/cargo-cabal | 109 | A tool that helps you to turn in one command a Rust crate into a Haskell Cabal library! | Rust | yvan-sraka | Yvan Sraka | |
src/lib.rs | Rust | //! # `hs-bindgen`
//!
//! Handy macro to generate C-FFI bindings to Rust for Haskell.
//!
//! This library intended to work best in a project configured by
//! [`cargo-cabal`](https://github.com/yvan-sraka/cargo-cabal).
//!
//! **N.B.** The MSRV is **1.64.0** since it use `core_ffi_c` feature.
//!
//! ## Examples
//!
... | yvan-sraka/hs-bindgen | 70 | Handy macro to generate C-FFI bindings to Rust for Haskell | Rust | yvan-sraka | Yvan Sraka | |
build.rs | Rust | //! Enable proc-macro diagnostics by default when toolchain is set on nightly!
fn main() {
if let Ok(v) = rustc_version::version_meta() {
if v.channel == rustc_version::Channel::Nightly {
println!("cargo:rustc-cfg=DIAGNOSTICS");
}
}
}
| yvan-sraka/hs-bindgen-attribute | 1 | Handy macro to generate C-FFI bindings from Rust to Haskell. | Rust | yvan-sraka | Yvan Sraka | |
src/haskell.rs | Rust | use displaydoc::Display;
use hs_bindgen_types::{ArrowIter, HsType};
use std::str::FromStr;
use thiserror::Error;
/// Produce the content of `lib/{module}.hs` given a list of Signature
pub(crate) fn template(module: &str, signatures: &[Signature]) -> String {
let modulename = module.replace("/", ".");
let names... | yvan-sraka/hs-bindgen-attribute | 1 | Handy macro to generate C-FFI bindings from Rust to Haskell. | Rust | yvan-sraka | Yvan Sraka | |
src/lib.rs | Rust | //! # `hs-bindgen-attribute`
//!
//! This library define the `#[hs_bindgen]` procedural macro used by
//! [`hs-bindgen`](https://github.com/yvan-sraka/hs-bindgen) library.
//!
//! ## Acknowledgments
//!
//! ⚠️ This is still a working experiment, not yet production ready.
//!
//! This project was part of a work assignme... | yvan-sraka/hs-bindgen-attribute | 1 | Handy macro to generate C-FFI bindings from Rust to Haskell. | Rust | yvan-sraka | Yvan Sraka | |
src/reflexive.rs | Rust | use crate::haskell;
#[cfg(feature = "reflexive")]
use hs_bindgen_types::HsType;
#[cfg(feature = "reflexive")]
lazy_static::lazy_static! {
static ref SANDBOX: reflexive::Sandbox =
reflexive::Sandbox::new("hs-bindgen")
.unwrap()
.deps(&["hs-bindgen-types@0.8"])
.unwrap()
... | yvan-sraka/hs-bindgen-attribute | 1 | Handy macro to generate C-FFI bindings from Rust to Haskell. | Rust | yvan-sraka | Yvan Sraka | |
src/rust.rs | Rust | use crate::{haskell, reflexive};
use hs_bindgen_types::HsType;
use proc_macro::TokenStream;
use quote::{format_ident, quote};
/// Generate extra Rust code that wrap our exposed function
pub(crate) fn generate(
attrs: TokenStream,
item_fn: syn::ItemFn,
) -> (haskell::Signature, TokenStream) {
let rust_fn = ... | yvan-sraka/hs-bindgen-attribute | 1 | Handy macro to generate C-FFI bindings from Rust to Haskell. | Rust | yvan-sraka | Yvan Sraka | |
src/toml.rs | Rust | use semver::{Version, VersionReq};
use serde::Deserialize;
use std::{env, fs, path::Path};
/// Struct that map the content of `hsbindgen.toml` config file
#[derive(Deserialize)]
pub(crate) struct Config {
pub(crate) default: Option<String>,
pub(crate) version: Option<String>,
}
/// Read `hsbindgen.toml` confi... | yvan-sraka/hs-bindgen-attribute | 1 | Handy macro to generate C-FFI bindings from Rust to Haskell. | Rust | yvan-sraka | Yvan Sraka | |
src/fun.rs | Rust | use crate::{private, FromReprRust};
macro_rules! repr_rust_fn {
() => {
impl<Output> FromReprRust<unsafe extern "C" fn() -> Output> for Box<dyn Fn() -> Output>
where
Output: private::CFFISafe + 'static,
{
fn from(f: unsafe extern "C" fn() -> Output) -> Self {
... | yvan-sraka/hs-bindgen-traits | 2 | Utility traits behind hs-bindgen ergonomics | Rust | yvan-sraka | Yvan Sraka | |
src/lib.rs | Rust | //! # `hs-bingen-traits`
//!
//! Utility traits behind [`hs-bindgen`](https://github.com/yvan-sraka/hs-bindgen)
//! ergonomics. It helps user to easily define wrapper function to derive a Rust
//! type from and into a C-FFI safe target type (that match the memory layout of
//! an Haskell type).
//!
//! ## What's this l... | yvan-sraka/hs-bindgen-traits | 2 | Utility traits behind hs-bindgen ergonomics | Rust | yvan-sraka | Yvan Sraka | |
src/str.rs | Rust | //! This module defines convenient traits to let user-defined function take as
//! argument or return type either `CString`, `&CStr`, `String` or `&str`
use crate::{FromReprC, FromReprRust};
use std::ffi::{c_char, CStr, CString};
impl FromReprRust<*const c_char> for CString {
#[inline]
fn from(ptr: *const c_c... | yvan-sraka/hs-bindgen-traits | 2 | Utility traits behind hs-bindgen ergonomics | Rust | yvan-sraka | Yvan Sraka | |
src/vec.rs | Rust | use crate::{private, FromReprC, FromReprRust};
// FIXME: study what could be a good `Vec<T>`/`&[T]` traits ergonomics ...
// n.b. the concept of `slice` have no C equivalent ...
// https://users.rust-lang.org/t/55118
impl<T, const N: usize> FromReprRust<*const T> for &[T; N]
where
*const T: private::CFFISafe,
{
... | yvan-sraka/hs-bindgen-traits | 2 | Utility traits behind hs-bindgen ergonomics | Rust | yvan-sraka | Yvan Sraka | |
src/lib.rs | Rust | use cfg_if::cfg_if;
use core::ffi::*;
use displaydoc::Display;
use proc_macro2::TokenStream;
use quote::quote;
use thiserror::Error;
/// Enumeration of all Haskell C-FFI safe types as the string representation of
/// their token in Haskell.
///
/// FIXME: `Errno(c_int)` should be implemented as a Rust `enum` ...
/// h... | yvan-sraka/hs-bindgen-types | 1 | Rust | yvan-sraka | Yvan Sraka | ||
dataLoader/__init__.py | Python | from .blender import BlenderDataset
from .ord import ORD
from .tensoIR_rotation_setting import TensoIR_Dataset_unknown_rotated_lights
from .tensoIR_relighting_test import tensoIR_Relighting_test
from .tensoIR_simple import TensoIR_Dataset_simple
from .tensoIR_material_editing_test import tensoIR_Material_Editing_test
... | yxlao/TensoIR | 3 | TensoIR Experiments for "Objects with Lighting: A Real-World Dataset for Evaluating Reconstruction and Rendering for Object Relighting" | Python | yxlao | Yixing Lao | HKU-CS |
dataLoader/blender.py | Python | import torch,cv2
from torch.utils.data import Dataset
import json
from tqdm import tqdm
import os
from PIL import Image
from torchvision import transforms as T
from dataLoader.ray_utils import *
from dataLoader.plotter import plot_cameras_and_scene_bbox
import camtools as ct
class BlenderDataset(Dataset):
def __... | yxlao/TensoIR | 3 | TensoIR Experiments for "Objects with Lighting: A Real-World Dataset for Evaluating Reconstruction and Rendering for Object Relighting" | Python | yxlao | Yixing Lao | HKU-CS |
dataLoader/colmap2nerf.py | Python | #!/usr/bin/env python3
# Copyright (c) 2020-2022, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribu... | yxlao/TensoIR | 3 | TensoIR Experiments for "Objects with Lighting: A Real-World Dataset for Evaluating Reconstruction and Rendering for Object Relighting" | Python | yxlao | Yixing Lao | HKU-CS |
dataLoader/ord.py | Python | import json
import os
from pathlib import Path
from typing import List
import camtools as ct
import cv2
import numpy as np
import open3d as o3d
import torch
from matplotlib import pyplot as plt
from torch.utils.data import Dataset
from tqdm import tqdm
from dataLoader.plotter import plot_cameras_and_scene_bbox, plot_... | yxlao/TensoIR | 3 | TensoIR Experiments for "Objects with Lighting: A Real-World Dataset for Evaluating Reconstruction and Rendering for Object Relighting" | Python | yxlao | Yixing Lao | HKU-CS |
dataLoader/plotter.py | Python | import os
import pickle
import tempfile
from pathlib import Path
from typing import Any, Dict, List, Tuple, Type
import camtools as ct
import numpy as np
import open3d as o3d
# - _geometries_cache_path will be set by get_geometries_cache_path() in the
# first run. Example of the path: /tmp/open3d_lf05831.pkl
# - Ev... | yxlao/TensoIR | 3 | TensoIR Experiments for "Objects with Lighting: A Real-World Dataset for Evaluating Reconstruction and Rendering for Object Relighting" | Python | yxlao | Yixing Lao | HKU-CS |
dataLoader/ray_utils.py | Python | import torch, re
import numpy as np
from torch import searchsorted
from kornia import create_meshgrid
import torch.nn.functional as F
# from utils import index_point_feature
def depth2dist(z_vals, cos_angle):
# z_vals: [N_ray N_sample]
device = z_vals.device
dists = z_vals[..., 1:] - z_vals[..., :-1]
... | yxlao/TensoIR | 3 | TensoIR Experiments for "Objects with Lighting: A Real-World Dataset for Evaluating Reconstruction and Rendering for Object Relighting" | Python | yxlao | Yixing Lao | HKU-CS |
dataLoader/tensoIR_general_multi_lights.py | Python | import os, random
import json
from pathlib import Path
import numpy as np
from PIL import Image
import cv2
from tqdm import tqdm
import torch
from torch.utils.data import Dataset
from torchvision import transforms as T
from dataLoader.ray_utils import *
from models.relight_utils import read_hdr
class TensoIR_Dataset_... | yxlao/TensoIR | 3 | TensoIR Experiments for "Objects with Lighting: A Real-World Dataset for Evaluating Reconstruction and Rendering for Object Relighting" | Python | yxlao | Yixing Lao | HKU-CS |
dataLoader/tensoIR_material_editing_test.py | Python |
import os, random
import json
from pathlib import Path
import numpy as np
from PIL import Image
import cv2
from tqdm import tqdm
import torch
from torch.utils.data import Dataset
from torchvision import transforms as T
from dataLoader.ray_utils import *
import torch.nn as nn
class tensoIR_Material_Editing_test(Data... | yxlao/TensoIR | 3 | TensoIR Experiments for "Objects with Lighting: A Real-World Dataset for Evaluating Reconstruction and Rendering for Object Relighting" | Python | yxlao | Yixing Lao | HKU-CS |
dataLoader/tensoIR_relighting_test.py | Python | import os, random
import json
from pathlib import Path
import numpy as np
from PIL import Image
import cv2
from tqdm import tqdm
import torch
from torch.utils.data import Dataset
from torchvision import transforms as T
from dataLoader.ray_utils import *
class tensoIR_Relighting_test(Dataset):
def __init__(self,
... | yxlao/TensoIR | 3 | TensoIR Experiments for "Objects with Lighting: A Real-World Dataset for Evaluating Reconstruction and Rendering for Object Relighting" | Python | yxlao | Yixing Lao | HKU-CS |
dataLoader/tensoIR_rotation_setting.py | Python | import os, random
import json
from pathlib import Path
import numpy as np
from PIL import Image
import cv2
from tqdm import tqdm
import torch
from torch.utils.data import Dataset
from torchvision import transforms as T
from dataLoader.ray_utils import *
from models.relight_utils import read_hdr
import torch.nn as nn
... | yxlao/TensoIR | 3 | TensoIR Experiments for "Objects with Lighting: A Real-World Dataset for Evaluating Reconstruction and Rendering for Object Relighting" | Python | yxlao | Yixing Lao | HKU-CS |
dataLoader/tensoIR_simple.py | Python |
import os
import json
from pathlib import Path
import numpy as np
from PIL import Image
from tqdm import tqdm
import torch
from torch.utils.data import Dataset
from torchvision import transforms as T
from dataLoader.ray_utils import *
from models.relight_utils import read_hdr
import torch.nn as nn
class TensoIR_Datas... | yxlao/TensoIR | 3 | TensoIR Experiments for "Objects with Lighting: A Real-World Dataset for Evaluating Reconstruction and Rendering for Object Relighting" | Python | yxlao | Yixing Lao | HKU-CS |
docker_patch.sh | Shell | #!/bin/bash
pip uninstall camtools -y
pip install git+https://gitee.com/yxlao/camtools.git -U
pip install tqdm scikit-image opencv-python configargparse lpips imageio-ffmpeg kornia lpips tensorboard loguru plyfile
pip install setuptools==59.5.0 imageio==2.11.1 yapf==0.30.0
| yxlao/TensoIR | 3 | TensoIR Experiments for "Objects with Lighting: A Real-World Dataset for Evaluating Reconstruction and Rendering for Object Relighting" | Python | yxlao | Yixing Lao | HKU-CS |
eval/prepare_eval.py | Python | from pathlib import Path
import json
import shutil
import camtools as ct
script_dir = Path(__file__).parent.absolute()
def all_eval_items_are_valid(eval_items):
"""
eval_items: list of dicts, with key: "gt_path", "pd_src_path", "pd_dst_path".
Return True if all paths are valid.
"""
all_paths = s... | yxlao/TensoIR | 3 | TensoIR Experiments for "Objects with Lighting: A Real-World Dataset for Evaluating Reconstruction and Rendering for Object Relighting" | Python | yxlao | Yixing Lao | HKU-CS |
gen_commands.py | Python | from pathlib import Path
_datasets_scenes = [
("ord", "antman"),
("ord", "apple"),
("ord", "chest"),
("ord", "gamepad"),
("ord", "ping_pong_racket"),
("ord", "porcelain_mug"),
("ord", "tpiece"),
("ord", "wood_bowl"),
# ("synth4relight_subsampled", "air_baloons"),
# ("synth4relig... | yxlao/TensoIR | 3 | TensoIR Experiments for "Objects with Lighting: A Real-World Dataset for Evaluating Reconstruction and Rendering for Object Relighting" | Python | yxlao | Yixing Lao | HKU-CS |
models/relight_utils.py | Python |
import numpy as np
import cv2
from loguru import logger
import torch
import torch.nn.functional as F
from models.relight_utils import *
from models.tensoRF_init import raw2alpha
import os
from pathlib import Path
def safe_l2_normalize(x, dim=None, eps=1e-6):
return F.normalize(x, p=2, dim=dim, eps=eps)
def GGX... | yxlao/TensoIR | 3 | TensoIR Experiments for "Objects with Lighting: A Real-World Dataset for Evaluating Reconstruction and Rendering for Object Relighting" | Python | yxlao | Yixing Lao | HKU-CS |
models/sh.py | Python | import torch
################## sh function ##################
C0 = 0.28209479177387814
C1 = 0.4886025119029199
C2 = [
1.0925484305920792,
-1.0925484305920792,
0.31539156525252005,
-1.0925484305920792,
0.5462742152960396
]
C3 = [
-0.5900435899266435,
2.890611442640554,
-0.45704579946446... | yxlao/TensoIR | 3 | TensoIR Experiments for "Objects with Lighting: A Real-World Dataset for Evaluating Reconstruction and Rendering for Object Relighting" | Python | yxlao | Yixing Lao | HKU-CS |
models/tensoRF_general_multi_lights.py | Python | from .tensorBase_general_multi_lights import *
from .relight_utils import grid_sample
class TensorVMSplit(TensorBase):
def __init__(self, aabb, gridSize, device, **kargs):
super(TensorVMSplit, self).__init__(aabb, gridSize, device, **kargs)
def init_svd_volume(self, res, device):
self.densi... | yxlao/TensoIR | 3 | TensoIR Experiments for "Objects with Lighting: A Real-World Dataset for Evaluating Reconstruction and Rendering for Object Relighting" | Python | yxlao | Yixing Lao | HKU-CS |
models/tensoRF_init.py | Python | from .tensorBase_init import *
class TensorVM(TensorBase_Init):
def __init__(self, aabb, gridSize, device, **kargs):
super(TensorVM, self).__init__(aabb, gridSize, device, **kargs)
def init_svd_volume(self, res, device):
self.plane_coef = torch.nn.Parameter(
0.1 * torch.r... | yxlao/TensoIR | 3 | TensoIR Experiments for "Objects with Lighting: A Real-World Dataset for Evaluating Reconstruction and Rendering for Object Relighting" | Python | yxlao | Yixing Lao | HKU-CS |
models/tensoRF_rotated_lights.py | Python | from .tensorBase_rotated_lights import *
from .relight_utils import grid_sample
class TensorVMSplit(TensorBase):
def __init__(self, aabb, gridSize, device, **kargs):
super(TensorVMSplit, self).__init__(aabb, gridSize, device, **kargs)
def init_svd_volume(self, res, device):
self.density_pla... | yxlao/TensoIR | 3 | TensoIR Experiments for "Objects with Lighting: A Real-World Dataset for Evaluating Reconstruction and Rendering for Object Relighting" | Python | yxlao | Yixing Lao | HKU-CS |
models/tensorBase_general_multi_lights.py | Python | import torch
import torch.nn as nn
import torch.nn.functional as F
from .sh import eval_sh_bases
import numpy as np
import time
from models.relight_utils import linear2srgb_torch
from dataLoader.ray_utils import safe_l2_normalize
# from torch_efficient_distloss import eff_distloss, eff_distloss_native, flatten_eff_dis... | yxlao/TensoIR | 3 | TensoIR Experiments for "Objects with Lighting: A Real-World Dataset for Evaluating Reconstruction and Rendering for Object Relighting" | Python | yxlao | Yixing Lao | HKU-CS |
models/tensorBase_init.py | Python | import torch
import torch.nn
import torch.nn.functional as F
from .sh import eval_sh_bases
import numpy as np
import time
def positional_encoding(positions, freqs):
freq_bands = (2**torch.arange(freqs).float()).to(positions.device) # (F,)
pts = (positions[..., None] * freq_bands).reshape(
... | yxlao/TensoIR | 3 | TensoIR Experiments for "Objects with Lighting: A Real-World Dataset for Evaluating Reconstruction and Rendering for Object Relighting" | Python | yxlao | Yixing Lao | HKU-CS |
models/tensorBase_rotated_lights.py | Python | import torch
import torch.nn as nn
import torch.nn.functional as F
from .sh import eval_sh_bases
import numpy as np
import time
from models.relight_utils import linear2srgb_torch
from dataLoader.ray_utils import safe_l2_normalize
# from torch_efficient_distloss import eff_distloss, eff_distloss_native, flatten_eff_dis... | yxlao/TensoIR | 3 | TensoIR Experiments for "Objects with Lighting: A Real-World Dataset for Evaluating Reconstruction and Rendering for Object Relighting" | Python | yxlao | Yixing Lao | HKU-CS |
opencv_tonemapping.py | Python | from pathlib import Path
import cv2
import numpy as np
import camtools as ct
def main():
hdr_path = Path.home() / "research/object-relighting-dataset/dataset/antman/test/gt_env_512_rotated_0000.hdr"
# Must read with cv2.IMREAD_ANYDEPTH
hdr = cv2.imread(hdr_path, cv2.IMREAD_ANYDEPTH)
# Apply -6 EV ex... | yxlao/TensoIR | 3 | TensoIR Experiments for "Objects with Lighting: A Real-World Dataset for Evaluating Reconstruction and Rendering for Object Relighting" | Python | yxlao | Yixing Lao | HKU-CS |
opt.py | Python | import configargparse
def config_parser(cmd=None):
parser = configargparse.ArgumentParser()
parser.add_argument('--config', is_config_file=True,
help='config file path')
parser.add_argument("--expname", type=str,
help='experiment name')
parser.add_argum... | yxlao/TensoIR | 3 | TensoIR Experiments for "Objects with Lighting: A Real-World Dataset for Evaluating Reconstruction and Rendering for Object Relighting" | Python | yxlao | Yixing Lao | HKU-CS |
renderer.py | Python | import numpy as np
import random
import os, imageio
from tqdm.auto import tqdm
from utils import *
from models.relight_utils import render_with_BRDF
import torch
import torchvision.utils as vutils
@torch.no_grad()
def compute_rescale_ratio_rgb(tensoIR, dataset, sampled_num=20):
'''compute three channel rescale ra... | yxlao/TensoIR | 3 | TensoIR Experiments for "Objects with Lighting: A Real-World Dataset for Evaluating Reconstruction and Rendering for Object Relighting" | Python | yxlao | Yixing Lao | HKU-CS |
scripts/export_mesh.py | Python | import torch
from opt import config_parser
from renderer import *
from models.tensoRF_rotated_lights import raw2alpha, TensorVMSplit, AlphaGridMask
from utils import *
args = config_parser()
print(args)
device = torch.device("cuda:{}".format(args.local_rank) if torch.cuda.is_available() else "cpu")
@torch.no_grad... | yxlao/TensoIR | 3 | TensoIR Experiments for "Objects with Lighting: A Real-World Dataset for Evaluating Reconstruction and Rendering for Object Relighting" | Python | yxlao | Yixing Lao | HKU-CS |
scripts/relight_importance.py | Python |
import os
from tqdm import tqdm
import imageio
import numpy as np
from opt import config_parser
import torch
import torch.nn as nn
from utils import visualize_depth_numpy
# ----------------------------------------
# use this if loaded checkpoint is generate from single-light or rotated multi-light setting
from model... | yxlao/TensoIR | 3 | TensoIR Experiments for "Objects with Lighting: A Real-World Dataset for Evaluating Reconstruction and Rendering for Object Relighting" | Python | yxlao | Yixing Lao | HKU-CS |
scripts/relight_ord.py | Python | import os
from tqdm import tqdm
import imageio
import numpy as np
from opt import config_parser
import torch
import torch.nn as nn
from utils import visualize_depth_numpy
# ----------------------------------------
# use this if loaded checkpoint is generate from single-light or rotated multi-light setting
from models.... | yxlao/TensoIR | 3 | TensoIR Experiments for "Objects with Lighting: A Real-World Dataset for Evaluating Reconstruction and Rendering for Object Relighting" | Python | yxlao | Yixing Lao | HKU-CS |
train_ord.py | Python |
import os
import sys
import torch
from tqdm.auto import tqdm
from opt import config_parser
import datetime
import torch.distributed as dist
from torch.utils.tensorboard import SummaryWriter
from renderer import *
from models.tensoRF_rotated_lights import raw2alpha, TensorVMSplit, AlphaGridMask
from utils import *
f... | yxlao/TensoIR | 3 | TensoIR Experiments for "Objects with Lighting: A Real-World Dataset for Evaluating Reconstruction and Rendering for Object Relighting" | Python | yxlao | Yixing Lao | HKU-CS |
train_tensoIR.py | Python | import os
import sys
import torch
from tqdm.auto import tqdm
from opt import config_parser
import datetime
import torch.distributed as dist
from torch.utils.tensorboard import SummaryWriter
from renderer import *
from models.tensoRF_rotated_lights import raw2alpha, TensorVMSplit, AlphaGridMask
from utils import *
fr... | yxlao/TensoIR | 3 | TensoIR Experiments for "Objects with Lighting: A Real-World Dataset for Evaluating Reconstruction and Rendering for Object Relighting" | Python | yxlao | Yixing Lao | HKU-CS |
train_tensoIR_general_multi_lights.py | Python | """
Author: Haian Jin 8/03/22
Feature:
"""
import os
import sys
import torch
from tqdm.auto import tqdm
from opt import config_parser
import datetime
import torch.distributed as dist
from torch.utils.tensorboard import SummaryWriter
from renderer import *
from models.tensoRF_general_multi_lights import raw2alpha, ... | yxlao/TensoIR | 3 | TensoIR Experiments for "Objects with Lighting: A Real-World Dataset for Evaluating Reconstruction and Rendering for Object Relighting" | Python | yxlao | Yixing Lao | HKU-CS |
train_tensoIR_rotated_multi_lights.py | Python | import os
import sys
import torch
from tqdm.auto import tqdm
from opt import config_parser
import datetime
import torch.distributed as dist
from torch.utils.tensorboard import SummaryWriter
from renderer import *
from models.tensoRF_rotated_lights import raw2alpha, TensorVMSplit, AlphaGridMask
from utils import *
fr... | yxlao/TensoIR | 3 | TensoIR Experiments for "Objects with Lighting: A Real-World Dataset for Evaluating Reconstruction and Rendering for Object Relighting" | Python | yxlao | Yixing Lao | HKU-CS |
utils.py | Python | import cv2, torch
import numpy as np
from PIL import Image
import torchvision.transforms as T
import torch.nn.functional as F
import scipy.signal
mse2psnr = lambda x : -10. * torch.log(x) / torch.log(torch.Tensor([10.]))
def visualize_depth_numpy(depth, minmax=None, cmap=cv2.COLORMAP_JET, mask=None):
"""
dep... | yxlao/TensoIR | 3 | TensoIR Experiments for "Objects with Lighting: A Real-World Dataset for Evaluating Reconstruction and Rendering for Object Relighting" | Python | yxlao | Yixing Lao | HKU-CS |
src/corres/corres_map.py | Python | import itertools
import json
import time
from pathlib import Path
import camtools as ct
import cv2
import igraph as ig
import numpy as np
import open3d as o3d
from tqdm import tqdm
from typing import List, Tuple
import json
class CorresMap:
"""
1. stores correspondences
2. map query and random sample
... | yxlao/corres-nerf | 49 | (NeurIPS 2023) CorresNeRF: Image Correspondence Priors for Neural Radiance Fields | yxlao | Yixing Lao | HKU-CS | |
src/corres/dataloader.py | Python | from pathlib import Path
import camtools as ct
import numpy as np
from ..nerf.load_llff import load_llff_data
from ..neus.dataset import unpack_neus_camera_npz
from tqdm import tqdm
def load_llff_cameras(scene_dir, factor):
"""
Args:
scene_dir: Path to the scene directory.
factor: Factor to ... | yxlao/corres-nerf | 49 | (NeurIPS 2023) CorresNeRF: Image Correspondence Priors for Neural Radiance Fields | yxlao | Yixing Lao | HKU-CS | |
src/corres/fused_matcher.py | Python | import numpy as np
from .matcher import Matcher
class FusedMatcher(Matcher):
def __init__(self, matchers):
super().__init__()
assert isinstance(matchers, list)
assert len(matchers) > 0
for matcher in matchers:
assert isinstance(matcher, Matcher)
self.matchers ... | yxlao/corres-nerf | 49 | (NeurIPS 2023) CorresNeRF: Image Correspondence Priors for Neural Radiance Fields | yxlao | Yixing Lao | HKU-CS | |
src/corres/matcher.py | Python | import abc
import itertools
import camtools as ct
import numpy as np
import torch
from matplotlib import pyplot as plt
from tqdm import tqdm
from .corres_map import CorresMap
class Matcher:
__metaclass__ = abc.ABCMeta
def __init__(self):
pass
@staticmethod
def assert_im_dtype_range_ndim(im... | yxlao/corres-nerf | 49 | (NeurIPS 2023) CorresNeRF: Image Correspondence Priors for Neural Radiance Fields | yxlao | Yixing Lao | HKU-CS | |
src/corres/matcher_dkm.py | Python | import functools
from pathlib import Path
import camtools as ct
import numpy as np
from dkm.models.model_zoo import DKMv3_indoor, DKMv3_outdoor
from matplotlib import pyplot as plt
from PIL import Image
from .matcher import Matcher
def numpy_to_pil(im_numpy):
"""
Convert a numpy array to an uint8 PIL image,... | yxlao/corres-nerf | 49 | (NeurIPS 2023) CorresNeRF: Image Correspondence Priors for Neural Radiance Fields | yxlao | Yixing Lao | HKU-CS | |
src/nerf/load_llff.py | Python | import os
import imageio
import numpy as np
########## Slightly modified version of LLFF data loading code
########## see https://github.com/Fyusion/LLFF for original
def _minify(basedir, factors=[], resolutions=[]):
needtoload = False
for r in factors:
imgdir = os.path.join(basedir, "images_{}".fo... | yxlao/corres-nerf | 49 | (NeurIPS 2023) CorresNeRF: Image Correspondence Priors for Neural Radiance Fields | yxlao | Yixing Lao | HKU-CS | |
src/nerf/run_nerf_helpers.py | Python | import numpy as np
import torch
# torch.autograd.set_detect_anomaly(True)
import torch.nn as nn
import torch.nn.functional as F
# Misc
img2mse = lambda x, y: torch.mean((x - y) ** 2)
mse2psnr = lambda x: -10.0 * torch.log(x) / torch.log(torch.Tensor([10.0]))
to8b = lambda x: (255 * np.clip(x, 0, 1)).astype(np.uint8)
... | yxlao/corres-nerf | 49 | (NeurIPS 2023) CorresNeRF: Image Correspondence Priors for Neural Radiance Fields | yxlao | Yixing Lao | HKU-CS | |
src/neus/dataset.py | Python | import os
from glob import glob
from pathlib import Path
import cv2 as cv
import numpy as np
import torch
from scipy.spatial.transform import Rotation as Rot
from scipy.spatial.transform import Slerp
from ..corres.corres_map import CorresMap, load_camera_split
# This function is borrowed from IDR: https://github.co... | yxlao/corres-nerf | 49 | (NeurIPS 2023) CorresNeRF: Image Correspondence Priors for Neural Radiance Fields | yxlao | Yixing Lao | HKU-CS | |
src/neus/embedder.py | Python | import torch
# Positional encoding embedding. Code was taken from https://github.com/bmild/nerf.
class Embedder:
def __init__(self, **kwargs):
self.kwargs = kwargs
self.create_embedding_fn()
def create_embedding_fn(self):
embed_fns = []
d = self.kwargs["input_dims"]
ou... | yxlao/corres-nerf | 49 | (NeurIPS 2023) CorresNeRF: Image Correspondence Priors for Neural Radiance Fields | yxlao | Yixing Lao | HKU-CS | |
src/neus/fields.py | Python | import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from .embedder import get_embedder
# This implementation is borrowed from IDR: https://github.com/lioryariv/idr
class SDFNetwork(nn.Module):
def __init__(
self,
d_in,
d_out,
d_hidden,
n_l... | yxlao/corres-nerf | 49 | (NeurIPS 2023) CorresNeRF: Image Correspondence Priors for Neural Radiance Fields | yxlao | Yixing Lao | HKU-CS | |
src/neus/renderer.py | Python | import mcubes
import numpy as np
import torch
import torch.nn.functional as F
def extract_fields(bound_min, bound_max, resolution, query_func):
N = 64
X = torch.linspace(bound_min[0], bound_max[0], resolution).split(N)
Y = torch.linspace(bound_min[1], bound_max[1], resolution).split(N)
Z = torch.linsp... | yxlao/corres-nerf | 49 | (NeurIPS 2023) CorresNeRF: Image Correspondence Priors for Neural Radiance Fields | yxlao | Yixing Lao | HKU-CS | |
src/neus/runner.py | Python | import logging
import math
import os
from pathlib import Path
from shutil import copyfile
import cv2 as cv
import numpy as np
import torch
import torch.nn.functional as F
import trimesh
from matplotlib import pyplot as plt
from pyhocon import ConfigFactory
from torch.utils.tensorboard import SummaryWriter
from tqdm im... | yxlao/corres-nerf | 49 | (NeurIPS 2023) CorresNeRF: Image Correspondence Priors for Neural Radiance Fields | yxlao | Yixing Lao | HKU-CS | |
src/tools/run_matcher.py | Python | import argparse
import itertools
import json
from pathlib import Path
import camtools as ct
import numpy as np
from tqdm import tqdm
from ..corres.corres_map import CorresMap, load_camera_split
from ..corres.dataloader import load_llff, load_dtu
from ..corres.matcher_dkm import MatcherDKM
from ..corres.fused_matcher ... | yxlao/corres-nerf | 49 | (NeurIPS 2023) CorresNeRF: Image Correspondence Priors for Neural Radiance Fields | yxlao | Yixing Lao | HKU-CS | |
src/tools/run_nerf.py | Python | import math
import os
import sys
import time
from pathlib import Path
import camtools as ct
import imageio
import numpy as np
import torch
import torch.nn.functional as F
from ..nerf.load_llff import load_llff_data
from ..nerf.run_nerf_helpers import (
img2mse,
mse2psnr,
to8b,
Embedder,
get_embedde... | yxlao/corres-nerf | 49 | (NeurIPS 2023) CorresNeRF: Image Correspondence Priors for Neural Radiance Fields | yxlao | Yixing Lao | HKU-CS | |
src/tools/run_neus.py | Python | import logging
import argparse
import numpy as np
from ..neus.runner import Runner
import torch
def func_train(args):
runner = Runner(
args.conf,
scene_name=args.case,
is_continue=args.is_continue,
from_checkpoint=args.from_checkpoint,
backup_code=True,
)
runner.tra... | yxlao/corres-nerf | 49 | (NeurIPS 2023) CorresNeRF: Image Correspondence Priors for Neural Radiance Fields | yxlao | Yixing Lao | HKU-CS | |
src/utils/eval_nerf_llff.py | Python | from pathlib import Path
import numpy as np
from tqdm import tqdm
import csv
from ..corres.corres_map import read_selected_cameras
from ..utils.eval_utils import (
eval_image_metrics_by_paths,
eval_depth_metrics_by_paths,
eval_dsnerf_depth_metrics_by_paths,
post_process_results,
)
# Global paths.
_pr... | yxlao/corres-nerf | 49 | (NeurIPS 2023) CorresNeRF: Image Correspondence Priors for Neural Radiance Fields | yxlao | Yixing Lao | HKU-CS | |
src/utils/eval_neus_dtu.py | Python | from pathlib import Path
from pyhocon import ConfigFactory
import json
from ..utils.eval_utils import (
eval_image_metrics_by_paths,
)
from ..corres.corres_map import read_selected_cameras
from ..utils.pydtu import dtu_chamfer_l1
from pprint import pprint
from tqdm import tqdm
import argparse
_pwd = Path(__file_... | yxlao/corres-nerf | 49 | (NeurIPS 2023) CorresNeRF: Image Correspondence Priors for Neural Radiance Fields | yxlao | Yixing Lao | HKU-CS | |
src/utils/eval_utils.py | Python | from pathlib import Path
import camtools as ct
import numpy as np
from tqdm import tqdm
def post_process_results(
results, sort_keys=("metric", "config", "scene"), decimal_points=3
):
"""
1. Sort results by sort_keys.
2. Round floating point numbers.
Args:
results (list[dict]): List of r... | yxlao/corres-nerf | 49 | (NeurIPS 2023) CorresNeRF: Image Correspondence Priors for Neural Radiance Fields | yxlao | Yixing Lao | HKU-CS | |
src/utils/pydtu.py | Python | import numpy as np
import open3d as o3d
import sklearn.neighbors as skln
from scipy.io import loadmat
import multiprocessing as mp
import argparse
from pathlib import Path
from tqdm import tqdm
def sample_single_tri(input_):
n1, n2, v1, v2, tri_vert = input_
c = np.mgrid[:n1 + 1, :n2 + 1]
c += 0.5
c[0... | yxlao/corres-nerf | 49 | (NeurIPS 2023) CorresNeRF: Image Correspondence Priors for Neural Radiance Fields | yxlao | Yixing Lao | HKU-CS | |
euler_angle_normalization.py | Python | from pathlib import Path
import open3d as o3d
from scipy.spatial.transform import Rotation
import numpy as np
import json
import open3d as o3d
import numpy as np
from scipy.spatial.transform import Rotation
from typing import Tuple, List
import copy
def main():
# rotmat = Rotation.from_matrix(R_bbox2cam)
# e... | yxlao/exchange | 0 | Sharing code snippets | Python | yxlao | Yixing Lao | HKU-CS |
o3d_texture/draw_texture_cube.py | Python | from pathlib import Path
import numpy as np
import open3d as o3d
from pathlib import Path
def main():
# Create source mesh
pwd = Path(__file__).parent
mesh_src = o3d.io.read_triangle_mesh(str(pwd / "cube.obj"),
enable_post_processing=True)
# Get all elements f... | yxlao/exchange | 0 | Sharing code snippets | Python | yxlao | Yixing Lao | HKU-CS |
open3d_ply_dtypes_0.15.py | Python | import open3d as o3d
import numpy as np
def main():
dataset = o3d.data.PLYPointCloud()
print(f"PLY path: {dataset.path}")
# Read with legacy. Legacy point cloud alway has double color.
pcd = o3d.io.read_point_cloud(dataset.path)
colors = np.array(pcd.colors)
print("Read using legacy point clo... | yxlao/exchange | 0 | Sharing code snippets | Python | yxlao | Yixing Lao | HKU-CS |
open3d_ply_dtypes_master.py | Python | import open3d as o3d
import numpy as np
def main():
dataset = o3d.data.PLYPointCloud()
print(f"PLY path: {dataset.path}")
# Read with legacy. Legacy point cloud alway has double color.
pcd = o3d.io.read_point_cloud(dataset.path)
colors = np.array(pcd.colors)
print("Read using legacy point clo... | yxlao/exchange | 0 | Sharing code snippets | Python | yxlao | Yixing Lao | HKU-CS |
lit/__init__.py | Python | import pkg_resources
__version__ = pkg_resources.get_distribution("lit").version
| yxlao/lit | 24 | (NeurIPS 2024) LiT: Unifying LiDAR "Languages" with LiDAR Translator | Python | yxlao | Yixing Lao | HKU-CS |
lit/bg_reconstructor.py | Python | import nksr
import open3d as o3d
import torch
class BGReconstructor:
"""
Background reconstructor with NKSR.
"""
def __init__(self, voxel_size=None, chunked=True) -> None:
"""
Args:
voxel_size: Voxel size for reconstruction. None means 0.1.
chunked: Whether to ... | yxlao/lit | 24 | (NeurIPS 2024) LiT: Unifying LiDAR "Languages" with LiDAR Translator | Python | yxlao | Yixing Lao | HKU-CS |
lit/containers/base_container.py | Python | import pickle
from abc import ABC
from collections.abc import Iterable
from pathlib import Path
from typing import Any, Iterable
import numpy as np
class BaseContainer(ABC):
"""
Abstract base class that implements the save() and load() methods by calling
to_dict() and from_dict(). Child classes must impl... | yxlao/lit | 24 | (NeurIPS 2024) LiT: Unifying LiDAR "Languages" with LiDAR Translator | Python | yxlao | Yixing Lao | HKU-CS |
lit/containers/fg_box.py | Python | from dataclasses import dataclass
from typing import List
import camtools as ct
import numpy as np
import open3d as o3d
from lit.containers.base_container import BaseContainer
from lit.recon_utils import bbox_to_lineset, scale_points_with_bbox
@dataclass
class FGBox(BaseContainer):
"""
Foreground box contai... | yxlao/lit | 24 | (NeurIPS 2024) LiT: Unifying LiDAR "Languages" with LiDAR Translator | Python | yxlao | Yixing Lao | HKU-CS |
lit/containers/fg_multiview.py | Python | from dataclasses import asdict, dataclass, field
from pathlib import Path
from typing import List
import camtools as ct
import numpy as np
import open3d as o3d
from pycg import vis
@dataclass
class FGMultiview:
"""
Container for multi-view foreground data. An instance of this class contains
multi-view sc... | yxlao/lit | 24 | (NeurIPS 2024) LiT: Unifying LiDAR "Languages" with LiDAR Translator | Python | yxlao | Yixing Lao | HKU-CS |
lit/containers/fg_object.py | Python | from dataclasses import dataclass, field
from typing import List
import numpy as np
import open3d as o3d
from lit.containers.base_container import BaseContainer
from lit.containers.fg_box import FGBox
from lit.recon_utils import bbox_to_lineset
@dataclass
class FGObject(BaseContainer):
"""
A group of FGBoxe... | yxlao/lit | 24 | (NeurIPS 2024) LiT: Unifying LiDAR "Languages" with LiDAR Translator | Python | yxlao | Yixing Lao | HKU-CS |
lit/containers/fg_scene.py | Python | from dataclasses import dataclass, field
from typing import List
import numpy as np
import open3d as o3d
from lit.containers.base_container import BaseContainer
from lit.containers.fg_box import FGBox
from lit.containers.fg_object import FGObject
from lit.recon_utils import bbox_to_lineset
@dataclass
class FGScene(... | yxlao/lit | 24 | (NeurIPS 2024) LiT: Unifying LiDAR "Languages" with LiDAR Translator | Python | yxlao | Yixing Lao | HKU-CS |
lit/containers/frame.py | Python | import copy
from dataclasses import dataclass
from typing import List
import camtools as ct
import numpy as np
from lit.containers.base_container import BaseContainer
@dataclass
class Frame(BaseContainer):
"""
TODO: rename points and bbox to local_points, etc.
"""
scene_name: str # Scene name
... | yxlao/lit | 24 | (NeurIPS 2024) LiT: Unifying LiDAR "Languages" with LiDAR Translator | Python | yxlao | Yixing Lao | HKU-CS |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.