![]() There are a few tools available to do this without any coding. I am a 3D Printing enthusiast so I set myself a challenge to use this library to create a 3D model of a photo that, when printed in translucent white is called a Lithophane. I recently recorded a four-part video series for my Youtube channel on how I attempted to create a 3D model out of a photo, using Python, Numpy, and Google Colab.įor this programming, I relied on the Numpy STL library which can create 3D models using “simple” Numpy arrays. Run python text-to-3d.py and enter your prompt when the program asks for it.How to create a 3D model of a photo using Python, NumPy and Google Colab - Part I With open(f'.ply', 'wb') as f:ĭecode_latent_mesh(xm, latent).tri_mesh().write_ply(f)ġ7. Size = 64 # this is the size of the renders higher values take longer to render.įrom shap_e.util.notebooks import decode_latent_mesh Render_mode = 'nerf' # you can change this to 'stf' Model = load_model('text300M', device=device)ĭiffusion = diffusion_from_config(load_config('diffusion')) Xm = load_model('transmitter', device=device) import torchįrom shap_e.diffusion.sample import sample_latentsįrom shap_e.diffusion.gaussian_diffusion import diffusion_from_configįrom shap_e.models.download import load_model, load_configįrom shap_e.util.notebooks import create_pan_cameras, decode_latent_images, gif_widgetĭevice = vice('cuda' if _available() else 'cpu') It will allow you to generate PLY files based on text prompts at the command line. Create the following python script and save it as text-to-3d.py or another name. You'll see a directory of folders and files.ġ6. ![]() Navigate to the localhost URL the software shows you. Enter the shap-e folder and run the install using pip. Git will create a shap-e folder underneath the one you cloned it from.Ĩ. If you get a cuda error, try running sudo apt install nvidia-cuda-dev and then repeating the process.Ħ. This is the area where it took me hours and hours to find a combination that worked. conda install pytorch torchvision torchaudio cpuonly -c pytorchĥ. The install is speedy but processing the actual 3D generation with the CPU was extremely slow in my experience. If you don't have an Nvidia card, you'll need to do a CPU-based install. conda install pytorch=1.13.0 torchvision pytorch-cuda=11.6 -c pytorch -c nvidia If you have an Nvidia graphics card, Use this command. Create a Conda environment called shap-e with Python 3.9 installed (other versions of Python may work). You can find a download and instructions on the Conda site.Ģ. Install Miniconda or Anaconda in Linux if you don't already have it. So the instructions below will work either in native Linux or in WSL2 under Windows. However, when I decided to use WSL2 (Windows Subsytem for Linux), I was able to get it up and running with few hassles. However, I kept running into problems, especially because I could not get Pytorch3D, a required library, to install. I attempted to install and run the software in Windows, using Miniconda to create a dedicated Python environment. OpenAI has posted a Shap-E repository to GitHub, along with some instructions on how to run it. I should note that the first time you run any of the scripts, it will need to download the models, which are 2 to 3 GB and could take several minutes to transfer. In short, if you are going to use Shap-E, make sure you have an Nvidia GPU (Shap-E doesn't support other brands of GPUs. However, when I tried doing text-to-3D on my old laptop, with has an Intel 8th Gen U series CPU and integrated graphics, it had only finished 3 percent of a render after an hour. On an Asus ROG Strix Scar 18 with an RTX 4090 laptop GPU and an Intel Core i9-13980HX, it took two to three minutes. On my home desktop, with an RTX 3080 GPU and a Ryzen 9 5900X CPU, it took about five minutes to complete a render. Whether I was doing text or image to 3D processing, Shap-E required a ton of system resources. However, it's likely that if I had a 2D PNG that looked a bit more 3D-ish (the way the corgi does), I'd get better results.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |