A toolkit for 3D vision
Project description
Kiuikit
pip install kiui
•
Documentation
A toolkit for computer vision (especially 3D vision) tasks.
Features:
- Collection of maintained, reusable and trustworthy code snippets.
- Always using lazy import so the code is not slowed down by
import kiui
. - Useful CLI tools, such as a GUI mesh renderer.
https://github.com/ashawkey/kiuikit/assets/25863658/d8cbcf0f-a6d8-4fa7-aee9-afbbf25ed167
"Seahourse3" by seanhepburn is licensed under Creative Commons Attribution.
Install
# released
pip install kiui # install the minimal package
pip install kiui[full] # install optional dependencies
# latest
pip install git+https://github.com/ashawkey/kiuikit.git # only the minimal package
Basic Usage
import kiui
### quick inspection of array-like object
x = torch.tensor(...)
y = np.array(...)
kiui.lo(x)
kiui.lo(x, y) # support multiple objects
kiui.lo(kiui) # or any other object (just print with name)
### io utils
# read image as-is in RGB order
img = kiui.read_image('image.png', mode='float') # mode: float (default), pil, uint8, tensor
# write image
kiui.write_image('image.png', img)
### visualization tools
img_tensor = torch.rand(3, 256, 256)
# tensor of [3, H, W], [1, H, W], [H, W] / array of [H, W ,3], [H, W, 1], [H, W] in [0, 1]
kiui.vis.plot_image(img)
kiui.vis.plot_image(img_tensor)
### mesh utils
from kiui.mesh import Mesh
mesh = Mesh.load('model.obj')
kiui.lo(mesh.v, mesh.f) # CUDA torch.Tensor suitable for nvdiffrast
mesh.write('new.obj')
mesh.write('new.glb') # support exporting to GLB/GLTF too (texture embedded).
# perceptual loss (from https://github.com/richzhang/PerceptualSimilarity)
from kiui.lpips import LPIPS
lpips = LPIPS(net='vgg').cuda()
loss = lpips(input, target) # [B, 3, H, W] image in [-1, 1]
CLI tools:
# sr (Real-ESRGAN from https://github.com/ai-forever/Real-ESRGAN/tree/main)
python -m kiui.sr --help
python -m kiui.sr image.jpg --scale 2 # save to image_2x.jpg
kisr image.jpg --scale 2 # short cut cmd
# mesh format conversion (only for a single textured mesh in obj/glb)
python -m kiui.cli.convert input.obj output.glb
kico input.obj output.glb # short cut cmd
kico mesh_folder video_folder --in_fmt .glb --out_fmt .mp4 # render all glb meshes into rotating videos
# aesthetic predictor v2 (https://github.com/christophschuhmann/improved-aesthetic-predictor)
python -m kiui.cli.aes --help
# compare content of two directories
python -m kiui.cli.dircmp <dir1> <dir2>
# lock requirements.txt package versions based on current environment
python -m kiui.cli.lock_version <requirements.txt>
GUI tools:
# open a GUI to render a mesh (extra dep: nvdiffrast)
python -m kiui.render --help
python -m kiui.render mesh.obj
python -m kiui.render mesh.glb --pbr # render with PBR (metallic + roughness)
python -m kiui.render mesh.obj --save_video out.mp4 --wogui # save 360 degree rotating video
kire --help # short cut cmd
# open a GUI to render and edit pose (openpose convention, controlnet compatible)
python -m kiui.poser --help
python -m kiui.poser --load 3head # load preset 3 headed skeleton
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
kiui-0.2.14.tar.gz
(3.1 MB
view details)
Built Distribution
kiui-0.2.14-py3-none-any.whl
(3.1 MB
view details)
File details
Details for the file kiui-0.2.14.tar.gz
.
File metadata
- Download URL: kiui-0.2.14.tar.gz
- Upload date:
- Size: 3.1 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3e336d16160187c554809b2b0992c83773b7d5ad0bb097145aaa9d5f9beba443 |
|
MD5 | 8289b31733fc5776fb66f6d63507868c |
|
BLAKE2b-256 | cf380ee99679437540c9d4f3b6025dcd2faa9b8b1f95c81cd00d95442c2d3cfd |
File details
Details for the file kiui-0.2.14-py3-none-any.whl
.
File metadata
- Download URL: kiui-0.2.14-py3-none-any.whl
- Upload date:
- Size: 3.1 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | dc3cab5eed4f430d0ecaece53cf9c4714f20456568d601951ab71fb914e3dbe9 |
|
MD5 | 236884fc02bca3679602cb858f0c8531 |
|
BLAKE2b-256 | e47e47f7b04c9dca8fae8d4593fe02e5d18e1a93f368b9ce71c2ee2a3f9e2b79 |