mirror of
https://github.com/facebookresearch/pytorch3d.git
synced 2025-12-22 23:30:35 +08:00
updates
This commit is contained in:
@@ -65,16 +65,16 @@
|
||||
</script></nav></div><div class="container mainContainer docsContainer"><div class="wrapper"><div class="post"><header class="postHeader"></header><article><div><span><h1><a class="anchor" aria-hidden="true" id="file-io"></a><a href="#file-io" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>File IO</h1>
|
||||
<p>There is a flexible interface for loading and saving point clouds and meshes from different formats.</p>
|
||||
<p>The main usage is via the <code>pytorch3d.io.IO</code> object, and its methods
|
||||
<code>load_mesh</code>, <code>save_mesh</code>, <code>load_point_cloud</code> and <code>save_point_cloud</code>.</p>
|
||||
<code>load_mesh</code>, <code>save_mesh</code>, <code>load_pointcloud</code> and <code>save_pointcloud</code>.</p>
|
||||
<p>For example, to load a mesh you might do</p>
|
||||
<pre><code class="hljs">from pytorch3d.io import IO
|
||||
|
||||
device=torch.device(<span class="hljs-string">"cuda:0"</span>)
|
||||
mesh = <span class="hljs-constructor">IO()</span>.load<span class="hljs-constructor">_mesh(<span class="hljs-string">"mymesh.ply"</span>, <span class="hljs-params">device</span>=<span class="hljs-params">device</span>)</span>
|
||||
mesh = <span class="hljs-constructor">IO()</span>.load<span class="hljs-constructor">_mesh(<span class="hljs-string">"mymesh.obj"</span>, <span class="hljs-params">device</span>=<span class="hljs-params">device</span>)</span>
|
||||
</code></pre>
|
||||
<p>and to save a pointcloud you might do</p>
|
||||
<pre><code class="hljs">pcl = <span class="hljs-constructor">Pointclouds(<span class="hljs-operator">...</span>)</span>
|
||||
<span class="hljs-constructor">IO()</span>.save<span class="hljs-constructor">_point_cloud(<span class="hljs-params">pcl</span>, <span class="hljs-string">"output_pointcloud.obj"</span>)</span>
|
||||
<span class="hljs-constructor">IO()</span>.save<span class="hljs-constructor">_pointcloud(<span class="hljs-params">pcl</span>, <span class="hljs-string">"output_pointcloud.ply"</span>)</span>
|
||||
</code></pre>
|
||||
<p>For meshes, this supports OBJ, PLY and OFF files.</p>
|
||||
<p>For pointclouds, this supports PLY files.</p>
|
||||
@@ -82,5 +82,5 @@ mesh = <span class="hljs-constructor">IO()</span>.load<span class="hljs-construc
|
||||
<a href="https://github.com/KhronosGroup/glTF/tree/master/specification/2.0">glTF 2 assets</a>
|
||||
stored either in a GLB container file or a glTF JSON file with embedded binary data.
|
||||
This must be enabled explicitly, as described in
|
||||
<code>pytorch3d/io/experimental_gltf_io.ply</code>.</p>
|
||||
</span></div></article></div><div class="docLastUpdate"><em>Last updated by Jeremy Reizenstein</em></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/why_pytorch3d"><span class="arrow-prev">← </span><span class="function-name-prevnext">Why PyTorch3D</span></a><a class="docs-next button" href="/docs/meshes_io"><span>Loading from file</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"></nav></div><footer class="nav-footer" id="footer"><section class="sitemap"><div class="footerSection"><div class="social"><a class="github-button" href="https://github.com/facebookresearch/pytorch3d" data-count-href="https://github.com/facebookresearch/pytorch3d/stargazers" data-show-count="true" data-count-aria-label="# stargazers on GitHub" aria-label="Star PyTorch3D on GitHub">pytorch3d</a></div></div></section><a href="https://opensource.facebook.com/" target="_blank" rel="noreferrer noopener" class="fbOpenSource"><img src="/img/oss_logo.png" alt="Facebook Open Source" width="170" height="45"/></a><section class="copyright">Copyright © 2022 Meta Platforms, Inc<br/>Legal:<a href="https://opensource.facebook.com/legal/privacy/" target="_blank" rel="noreferrer noopener">Privacy</a><a href="https://opensource.facebook.com/legal/terms/" target="_blank" rel="noreferrer noopener">Terms</a></section></footer></div></body></html>
|
||||
<code>pytorch3d/io/experimental_gltf_io.py</code>.</p>
|
||||
</span></div></article></div><div class="docLastUpdate"><em>Last updated by Jeremy Reizenstein</em></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/why_pytorch3d"><span class="arrow-prev">← </span><span class="function-name-prevnext">Why PyTorch3D</span></a><a class="docs-next button" href="/docs/meshes_io"><span>Loading from file</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"></nav></div><footer class="nav-footer" id="footer"><section class="sitemap"><div class="footerSection"><div class="social"><a class="github-button" href="https://github.com/facebookresearch/pytorch3d" data-count-href="https://github.com/facebookresearch/pytorch3d/stargazers" data-show-count="true" data-count-aria-label="# stargazers on GitHub" aria-label="Star PyTorch3D on GitHub">pytorch3d</a></div></div></section><a href="https://opensource.facebook.com/" target="_blank" rel="noreferrer noopener" class="fbOpenSource"><img src="/img/oss_logo.png" alt="Facebook Open Source" width="170" height="45"/></a><section class="copyright">Copyright © 2023 Meta Platforms, Inc<br/>Legal:<a href="https://opensource.facebook.com/legal/privacy/" target="_blank" rel="noreferrer noopener">Privacy</a><a href="https://opensource.facebook.com/legal/terms/" target="_blank" rel="noreferrer noopener">Terms</a></section></footer></div></body></html>
|
||||
Reference in New Issue
Block a user