Skip to main content

kiui kit

A toolkit for personal use.

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

Usage

import kiui

### auto import
kiui.env() # os, glob, math, time, random, argparse
kiui.env('data') # above + np, plt, cv2, Image, ...
kiui.env('torch') # above + torch, nn, F, ...

### 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:

# background removal utils
python -m kiui.cli.bg --help
python -m kiui.cli.bg input.png output.png
python -m kiui.cli.bg input_folder output_folder

# openpose detector
python -m kiui.cli.pose --help

# hed edge detector
python -m kiui.cli.hed --help

# open a GUI to render a mesh (extra dependency: nvdiffrast)
python -m kiui.render --help
python -m kiui.render mesh.obj
python -m kiui.render mesh.obj --save_video out.mp4 --wogui # save 360 degree rotating video

# 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

Release files for kiui 0.1.8

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for kiui 0.1.8
File Size Uploaded
kiui-0.1.8.tar.gz 29.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for kiui 0.1.8
File Interpreter ABI Platform
kiui-0.1.8-py3-none-any.whl Python 3 none any Details

Total release size: 60.8 kB

Release files / kiui-0.1.8.tar.gz

Download URL kiui-0.1.8.tar.gz
Size 29.6 kB
Tags Source
SHA-256 checksum
How to use checksums
1b05382dd25e436d450720050e4d247d6b323f70bf1d57157a242fcf9aa5f07b
BLAKE2b-256 checksum
How to use checksums
0e860be5added71bc45fd1ac46ba4bced61462ef123291cf2a28c0f8b566300b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.4

Release files / kiui-0.1.8-py3-none-any.whl

Download URL kiui-0.1.8-py3-none-any.whl
Size 31.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2ffde8ddf362d9f16e4f28c5182620e7d83ea83369fe4b4284710b20de2c2ea8
BLAKE2b-256 checksum
How to use checksums
14774cb89c9b5955bbd0ae1019fbdf4422efe6134a67fb905b4af92126b7b632
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.4

Release history Release notifications | RSS feed

0.3.5

2 release files

0.3.4

2 release files

0.3.3

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.20

2 release files

0.2.17

2 release files

0.2.16

2 release files

0.2.14

2 release files

0.2.12

2 release files

0.2.11

2 release files

0.2.10

2 release files

0.2.9

2 release files

0.2.8

2 release files

0.2.7

2 release files

0.2.6

2 release files

0.2.5

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.9

2 release files

This release

0.1.8 This release

2 release files

0.1.7

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page