Package: kiui
Kiuikitpip install kiui•DocumentationA toolkit for computer vision (especially 3D vision) tasks.Features:Collection ofmaintained, reusable and trustworthycode snippets.Always using lazy import so the code is not slowed down byimport kiui.Useful CLI tools, such as a GUI mesh renderer.Install# releasedpipinstallkiui# install the minimal packagepipinstallkiui[full]# install optional dependencies# latestpipinstallgit+https://github.com/ashawkey/kiuikit.git# only the minimal packageBasic Usageimportkiui### auto importkiui.env()# os, glob, math, time, random, argparsekiui.env('data')# above + np, plt, cv2, Image, ...kiui.env('torch')# above + torch, nn, F, ...### quick inspection of array-like objectx=torch.tensor(...)y=np.array(...)kiui.lo(x)kiui.lo(x,y)# support multiple objectskiui.lo(kiui)# or any other object (just print with name)### io utils# read image as-is in RGB orderimg=kiui.read_image('image.png',mode='float')# mode: float (default), pil, uint8, tensor# write imagekiui.write_image('image.png',img)### visualization toolsimg_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 utilsfromkiui.meshimportMeshmesh=Mesh.load('model.obj')kiui.lo(mesh.v,mesh.f)# CUDA torch.Tensor suitable for nvdiffrastmesh.write('new.obj')mesh.write('new.glb')# support exporting to GLB/GLTF too (texture embedded).# perceptual loss (from https://github.com/richzhang/PerceptualSimilarity)fromkiui.lpipsimportLPIPSlpips=LPIPS(net='vgg').cuda()loss=lpips(input,target)# [B, 3, H, W] image in [-1, 1]CLI tools:# background removal utilspython-mkiui.cli.bg--help
python-mkiui.cli.bginput.pngoutput.png
python-mkiui.cli.bginput_folderoutput_folder# openpose detectorpython-mkiui.cli.pose--help# blip2 image captioningpython-mkiui.cli.blip--help# hed edge detectorpython-mkiui.cli.hed--help# zoe depth estimation (extra dep: pip install timm==0.6.11)python-mkiui.cli.depth_zoe--help# midas depth estimation (dpt-large)python-mkiui.cli.depth_midas--help# sr (Real-ESRGAN from https://github.com/ai-forever/Real-ESRGAN/tree/main)python-mkiui.sr--help
python-mkiui.srimage.jpg--scale2# save to image_2x.jpgkisrimage.jpg--scale2# short cut cmd# made-in-heaven timer (https://github.com/ashawkey/made-in-heaven-timer)python-mkiui.cli.timer--help# mesh format conversion (only for a single textured mesh in obj/glb)python-mkiui.cli.convertinput.objoutput.glb
kicoinput.objoutput.glb# short cut cmdkicomesh_folder/video_folder--fmt.mp4# render all meshes into rotating videos# aesthetic predictor v2 (https://github.com/christophschuhmann/improved-aesthetic-predictor)python-mkiui.cli.aes--help# compare content of two directoriespython-mkiui.cli.dircmp<dir1><dir2># lock requirements.txt package versions based on current environmentpython-mkiui.cli.lock_version<requirements.txt>GUI tools:# open a GUI to render a mesh (extra dep: nvdiffrast)python-mkiui.render--help
python-mkiui.rendermesh.obj
python-mkiui.rendermesh.glb--pbr# render with PBR (metallic + roughness)python-mkiui.rendermesh.obj--save_videoout.mp4--wogui# save 360 degree rotating videokire--help# short cut cmd# open a GUI to render and edit pose (openpose convention, controlnet compatible)python-mkiui.poser--help
python-mkiui.poser--load3head# load preset 3 headed skeletonWebGUI tools:# open a web GUI to render a mesh (extra dep: viser)python-mkiui.render_viser--help
vire--help# short cut cmd