import{s as vt,n as xt,o as bt}from"../chunks/scheduler.7bc62968.js";import{S as yt,i as _t,g as l,s,r as W,m as v,H as O,A as $t,h as r,f as a,c as i,j as Ee,u as A,x as h,n as x,B as X,k as pt,l as p,y as g,a as n,v as E,d as G,t as B,w as U}from"../chunks/index.2f8492b0.js";import{H as Q,E as Tt}from"../chunks/EditOnGithub.2a9ce03a.js";function Mt(Ge){let w,Y,J,ee,b,te,y,Be=`We’ve seen in the NeRF chapter how, given a large set of images, we can generate a three-dimensional representation of an object.
But sometimes we have only a handful of images or even just one.
Novel View Synthesis (NVS) is a collection of methods to generate views from new camera angles that are plausibly consistent with a set of images.
Once we have a large, consistent set of images we can use NeRF or a similar algorithm to construct a 3D representation.`,ae,_,Ue=`Many methods have recently been developed for this task.
However, they can be divided into two general classes - those that generate an intermediate three-dimensional representation, which is rendered from a new viewing direction, and those that directly produce a new image.`,ne,$,Oe=`One key difficulty is that this task is almost always underdetermined.
For example, for an image of the back of a sign, there are many possible different things that could be on the front.
Similarly, there could be parts of the object that are occluded, with one part of an object in front of another.
If a model is trained to directly predict (regress) the unseen parts, with a loss penalizing errors in reconstructing held-out views, then by necessity the model will, when it is not clear what should be there, predict a blurry, grey colored region, as noted in <a href="https://jiataogu.me/nerfdiff/" rel="nofollow">NerfDiff</a>.
This has spurred interest in the use of generative, diffusion-based models, which are able to sample from multiple plausible possibilities for the unseen regions.`,se,T,Xe=`Here we will briefly discuss two approaches, which are representative of the two classes.
<a href="https://alexyu.net/pixelnerf" rel="nofollow">PixelNeRF</a> directly predicts a NeRF for the scene from an input image.
<a href="https://zero123.cs.columbia.edu/" rel="nofollow">Zero123</a> adapts the Stable Diffusion latent diffusion model to directly generate new views without an intermediate 3D representation.`,ie,M,le,k,Qe=`PixelNeRF is a method that directly generates the parameters of a NeRF from one or more images.
In other words, it conditions the NeRF on the input images.
Unlike the original NeRF, which trains a MLP which takes spatial points to a density and color, PixelNeRF uses spatial features generated from the input images.`,re,f,Je='<img src="https://huggingface.co/datasets/hf-vision/course-assets/resolve/main/PixelNeRF_pipeline.png" alt="PixelNeRF diagram"/> <p>Image from: <a href="https://alexyu.net/pixelnerf">PixelNeRF</a></p>',oe,o,Ve,We,Ae,he,ft='<span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>x</mi></mrow><annotation encoding="application/x-tex"> x </annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.4306em;"></span><span class="mord mathnormal">x</span></span></span></span>',me,pe,dt='<span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>π</mi></mrow><annotation encoding="application/x-tex"> \\pi </annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.4306em;"></span><span class="mord mathnormal" style="margin-right:0.03588em;">π</span></span></span></span>',fe,de,ut='<span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>W</mi><mo stretchy="false">(</mo><mi>π</mi><mi>x</mi><mo stretchy="false">)</mo></mrow><annotation encoding="application/x-tex"> W(\\pi x) </annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord mathnormal" style="margin-right:0.13889em;">W</span><span class="mopen">(</span><span class="mord mathnormal" style="margin-right:0.03588em;">π</span><span class="mord mathnormal">x</span><span class="mclose">)</span></span></span></span>',ue,ce,ct='<span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>x</mi></mrow><annotation encoding="application/x-tex"> x </annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.4306em;"></span><span class="mord mathnormal">x</span></span></span></span>',ge,we,gt='<span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>d</mi></mrow><annotation encoding="application/x-tex"> d</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6944em;"></span><span class="mord mathnormal">d</span></span></span></span>',ve,xe,wt='<span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>W</mi><mo stretchy="false">(</mo><mi>π</mi><mo stretchy="false">(</mo><mi>x</mi><mo stretchy="false">)</mo><mo stretchy="false">)</mo></mrow><annotation encoding="application/x-tex"> W(\\pi(x)) </annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord mathnormal" style="margin-right:0.13889em;">W</span><span class="mopen">(</span><span class="mord mathnormal" style="margin-right:0.03588em;">π</span><span class="mopen">(</span><span class="mord mathnormal">x</span><span class="mclose">))</span></span></span></span>',be,ye,R,Ke=`The original PixelNeRF model was trained on a relatively small set of renderings from the <a href="https://huggingface.co/datasets/ShapeNet/ShapeNetCore" rel="nofollow">ShapeNet</a> dataset.
The model is trained with either one or two input images, and attempts to predict a single novel view from a new camera angle.
The loss is the mean-squared error between the rendered and expected novel views.
A model was trained separately on each class of object (e.g. planes, benches, cars).`,_e,N,$e,d,Ye='<img src="https://huggingface.co/datasets/hf-vision/course-assets/resolve/main/PixelNeRF_input.png" alt="Input image of a chair"/>',Te,u,et='<img src="https://huggingface.co/datasets/hf-vision/course-assets/resolve/main/PixelNeRF_output.gif" alt="Rotating gif animation of rendered novel views"/> <p>Image from: <a href="https://alexyu.net/pixelnerf">PixelNeRF</a></p>',Me,L,tt='The PixelNeRF code can be found on <a href="https://github.com/sxyu/pixel-nerf" rel="nofollow">GitHub</a>',ke,H,Re,P,at='In the <a href="https://arxiv.org/pdf/2307.05663.pdf" rel="nofollow">ObjaverseXL</a> paper, PixelNeRF was trained on a <em>much</em> larger dataset <a href="https://huggingface.co/datasets/allenai/objaverse-xl" rel="nofollow">allenai/objaverse-xl</a>.',Ne,C,nt=`See also - <a href="https://deepmind.google/discover/blog/neural-scene-representation-and-rendering/" rel="nofollow">Generative Query Networks</a>,
<a href="https://www.vincentsitzmann.com/srns/" rel="nofollow">Scene Representation Networks</a>,
<a href="https://arxiv.org/pdf/2311.04400.pdf" rel="nofollow">LRM</a>`,Le,F,He,S,st=`Zero123 takes a different approach, being a diffusion model.
Rather than trying to generate a three-dimensional representation, it instead directly predicts the image from the new views.
The model takes a single input image, and the relative viewpoint transformation between the input and novel view direction.
It attempts to generate a plausible, 3D-consistent image from the novel view direction.`,Pe,j,it=`Zero123 is built upon the <a href="https://arxiv.org/abs/2112.10752" rel="nofollow">Stable Diffusion</a> architecture, and it was trained by fine-tuning existing weights.<br/>
However, it adds a few new twists.
The model actually starts with the weights from <a href="https://huggingface.co/spaces/lambdalabs/stable-diffusion-image-variations" rel="nofollow">Stable Diffusion Image Variations</a>, which uses the CLIP image embeddings (the final hidden state) of the input image to condition the diffusion U-Net, instead of a text prompt.
However, here these CLIP image embeddings are concatenated with the relative viewpoint transformation between the input and novel views.
(This viewpoint change is represented in terms of spherical polar coordinates.)`,Ce,c,lt='<img src="https://huggingface.co/datasets/hf-vision/course-assets/resolve/main/Zero123.png" alt="Zero123"/> <p>Image from: <a href="https://zero123.cs.columbia.edu">https://zero123.cs.columbia.edu</a></p>',Fe,z,rt=`The rest of the architecture is the same as Stable Diffusion.
However, the latent representation of the input image is concatenated channel-wise with the noisy latents before being input into the denoising U-Net.`,Se,I,ot='To explore this model further, see the <a href="https://huggingface.co/spaces/cvlab/zero123-live" rel="nofollow">Live Demo</a>',je,D,ze,q,ht=`<a href="https://3d-diffusion.github.io/" rel="nofollow">3DiM</a> - X-UNet architecture, with cross-attention between input and noisy frames.
<a href="https://arxiv.org/pdf/2311.13617.pdf" rel="nofollow">Zero123-XL</a> - Trained on the larger objaverseXL dataset. See also <a href="https://huggingface.co/stabilityai/stable-zero123" rel="nofollow">Stable Zero 123</a>`,Ie,Z,mt='<a href="https://arxiv.org/abs/2310.15110" rel="nofollow">Zero123++</a> - Generates 6 new fixed views, at fixed relative positions to the input view, with reference attention between input and generated images',De,V,qe,K,Ze;return b=new Q({props:{title:"Novel View Synthesis",local:"novel-view-synthesis",headingTag:"h1"}}),M=new Q({props:{title:"PixelNeRF",local:"pixelnerf",headingTag:"h2"}}),N=new Q({props:{title:"Results (from the PixelNeRF website)",local:"results-from-the-pixelnerf-website",headingTag:"h3"}}),H=new Q({props:{title:"Related methods",local:"related-methods",headingTag:"h3"}}),F=new Q({props:{title:"Zero123 (or Zero-1-to-3)",local:"zero123-or-zero-1-to-3",headingTag:"h2"}}),D=new Q({props:{title:"Related methods",local:"related-methods",headingTag:"h3"}}),V=new Tt({props:{source:"https://github.com/johko/computer-vision-course/blob/main/chapters/en/unit8/3d-vision/nvs.mdx"}}),{c(){w=l("meta"),Y=s(),J=l("p"),ee=s(),W(b.$$.fragment),te=s(),y=l("p"),y.textContent=Be,ae=s(),_=l("p"),_.textContent=Ue,ne=s(),$=l("p"),$.innerHTML=Oe,se=s(),T=l("p"),T.innerHTML=Xe,ie=s(),W(M.$$.fragment),le=s(),k=l("p"),k.textContent=Qe,re=s(),f=l("div"),f.innerHTML=Je,oe=s(),o=l("p"),Ve=v("The method first passes the input images through a convolutional neural network (ResNet34), bilinearly upsampling features from multiple layers to the same resolution as the input images."),We=l("br"),Ae=v(`
As in a standard NeRF, the new view is generated by volume rendering.
However, the NeRF itself has a slightly unusual structure.
At each query point`),he=new O(!1),me=v(" in the rendered volume, the corresponding point in the input image(s) is found (by projecting it using the input image camera transformation"),pe=new O(!1),fe=v(` ).
The input image features at this point,`),de=new O(!1),ue=v(` are then found by bilinear interpolation.
Like in the original NeRF, the query point`),ce=new O(!1),ge=v(" is positionally encoded and concatentated with the viewing direction"),we=new O(!1),ve=v(`.
The NeRF network consists of a set of ResNet blocks; the input image features`),xe=new O(!1),be=v(` pass through a linear layer, and are added to the features at the start of each of the first three residual blocks.
There are then two more residual blocks to further process these features, before an output layer reduces the number of channels to four (RGB+density).
When multiple input views are supplied, these are processed independently for the first three residual blocks, and then the features are averaged before the last two blocks.`),ye=s(),R=l("p"),R.innerHTML=Ke,_e=s(),W(N.$$.fragment),$e=s(),d=l("div"),d.innerHTML=Ye,Te=s(),u=l("div"),u.innerHTML=et,Me=s(),L=l("p"),L.innerHTML=tt,ke=s(),W(H.$$.fragment),Re=s(),P=l("p"),P.innerHTML=at,Ne=s(),C=l("p"),C.innerHTML=nt,Le=s(),W(F.$$.fragment),He=s(),S=l("p"),S.textContent=st,Pe=s(),j=l("p"),j.innerHTML=it,Ce=s(),c=l("div"),c.innerHTML=lt,Fe=s(),z=l("p"),z.textContent=rt,Se=s(),I=l("p"),I.innerHTML=ot,je=s(),W(D.$$.fragment),ze=s(),q=l("p"),q.innerHTML=ht,Ie=s(),Z=l("p"),Z.innerHTML=mt,De=s(),W(V.$$.fragment),qe=s(),K=l("p"),this.h()},l(e){const t=$t("svelte-u9bgzb",document.head);w=r(t,"META",{name:!0,content:!0}),t.forEach(a),Y=i(e),J=r(e,"P",{}),Ee(J).forEach(a),ee=i(e),A(b.$$.fragment,e),te=i(e),y=r(e,"P",{"data-svelte-h":!0}),h(y)!=="svelte-md009s"&&(y.textContent=Be),ae=i(e),_=r(e,"P",{"data-svelte-h":!0}),h(_)!=="svelte-ip51yg"&&(_.textContent=Ue),ne=i(e),$=r(e,"P",{"data-svelte-h":!0}),h($)!=="svelte-1qxehg6"&&($.innerHTML=Oe),se=i(e),T=r(e,"P",{"data-svelte-h":!0}),h(T)!=="svelte-zc8dx0"&&(T.innerHTML=Xe),ie=i(e),A(M.$$.fragment,e),le=i(e),k=r(e,"P",{"data-svelte-h":!0}),h(k)!=="svelte-ujrcl0"&&(k.textContent=Qe),re=i(e),f=r(e,"DIV",{style:!0,"data-svelte-h":!0}),h(f)!=="svelte-1tanwpg"&&(f.innerHTML=Je),oe=i(e),o=r(e,"P",{});var m=Ee(o);Ve=x(m,"The method first passes the input images through a convolutional neural network (ResNet34), bilinearly upsampling features from multiple layers to the same resolution as the input images."),We=r(m,"BR",{}),Ae=x(m,`
As in a standard NeRF, the new view is generated by volume rendering.
However, the NeRF itself has a slightly unusual structure.
At each query point`),he=X(m,!1),me=x(m," in the rendered volume, the corresponding point in the input image(s) is found (by projecting it using the input image camera transformation"),pe=X(m,!1),fe=x(m,` ).
The input image features at this point,`),de=X(m,!1),ue=x(m,` are then found by bilinear interpolation.
Like in the original NeRF, the query point`),ce=X(m,!1),ge=x(m," is positionally encoded and concatentated with the viewing direction"),we=X(m,!1),ve=x(m,`.
The NeRF network consists of a set of ResNet blocks; the input image features`),xe=X(m,!1),be=x(m,` pass through a linear layer, and are added to the features at the start of each of the first three residual blocks.
There are then two more residual blocks to further process these features, before an output layer reduces the number of channels to four (RGB+density).
When multiple input views are supplied, these are processed independently for the first three residual blocks, and then the features are averaged before the last two blocks.`),m.forEach(a),ye=i(e),R=r(e,"P",{"data-svelte-h":!0}),h(R)!=="svelte-18yx0n5"&&(R.innerHTML=Ke),_e=i(e),A(N.$$.fragment,e),$e=i(e),d=r(e,"DIV",{style:!0,"data-svelte-h":!0}),h(d)!=="svelte-otoniy"&&(d.innerHTML=Ye),Te=i(e),u=r(e,"DIV",{style:!0,"data-svelte-h":!0}),h(u)!=="svelte-mnkkqu"&&(u.innerHTML=et),Me=i(e),L=r(e,"P",{"data-svelte-h":!0}),h(L)!=="svelte-zil5op"&&(L.innerHTML=tt),ke=i(e),A(H.$$.fragment,e),Re=i(e),P=r(e,"P",{"data-svelte-h":!0}),h(P)!=="svelte-jcdds8"&&(P.innerHTML=at),Ne=i(e),C=r(e,"P",{"data-svelte-h":!0}),h(C)!=="svelte-ien78q"&&(C.innerHTML=nt),Le=i(e),A(F.$$.fragment,e),He=i(e),S=r(e,"P",{"data-svelte-h":!0}),h(S)!=="svelte-177283l"&&(S.textContent=st),Pe=i(e),j=r(e,"P",{"data-svelte-h":!0}),h(j)!=="svelte-2ht5cx"&&(j.innerHTML=it),Ce=i(e),c=r(e,"DIV",{style:!0,"data-svelte-h":!0}),h(c)!=="svelte-nqz91t"&&(c.innerHTML=lt),Fe=i(e),z=r(e,"P",{"data-svelte-h":!0}),h(z)!=="svelte-5qhqp7"&&(z.textContent=rt),Se=i(e),I=r(e,"P",{"data-svelte-h":!0}),h(I)!=="svelte-ggnn2t"&&(I.innerHTML=ot),je=i(e),A(D.$$.fragment,e),ze=i(e),q=r(e,"P",{"data-svelte-h":!0}),h(q)!=="svelte-117i4gt"&&(q.innerHTML=ht),Ie=i(e),Z=r(e,"P",{"data-svelte-h":!0}),h(Z)!=="svelte-1yfjeya"&&(Z.innerHTML=mt),De=i(e),A(V.$$.fragment,e),qe=i(e),K=r(e,"P",{}),Ee(K).forEach(a),this.h()},h(){pt(w,"name","hf:doc:metadata"),pt(w,"content",kt),p(f,"display","flex"),p(f,"flex-direction","column"),p(f,"align-items","center"),he.a=me,pe.a=fe,de.a=ue,ce.a=ge,we.a=ve,xe.a=be,p(d,"display","flex"),p(d,"flex-direction","column"),p(d,"align-items","center"),p(u,"display","flex"),p(u,"flex-direction","column"),p(u,"align-items","center"),p(c,"display","flex"),p(c,"flex-direction","column"),p(c,"align-items","center")},m(e,t){g(document.head,w),n(e,Y,t),n(e,J,t),n(e,ee,t),E(b,e,t),n(e,te,t),n(e,y,t),n(e,ae,t),n(e,_,t),n(e,ne,t),n(e,$,t),n(e,se,t),n(e,T,t),n(e,ie,t),E(M,e,t),n(e,le,t),n(e,k,t),n(e,re,t),n(e,f,t),n(e,oe,t),n(e,o,t),g(o,Ve),g(o,We),g(o,Ae),he.m(ft,o),g(o,me),pe.m(dt,o),g(o,fe),de.m(ut,o),g(o,ue),ce.m(ct,o),g(o,ge),we.m(gt,o),g(o,ve),xe.m(wt,o),g(o,be),n(e,ye,t),n(e,R,t),n(e,_e,t),E(N,e,t),n(e,$e,t),n(e,d,t),n(e,Te,t),n(e,u,t),n(e,Me,t),n(e,L,t),n(e,ke,t),E(H,e,t),n(e,Re,t),n(e,P,t),n(e,Ne,t),n(e,C,t),n(e,Le,t),E(F,e,t),n(e,He,t),n(e,S,t),n(e,Pe,t),n(e,j,t),n(e,Ce,t),n(e,c,t),n(e,Fe,t),n(e,z,t),n(e,Se,t),n(e,I,t),n(e,je,t),E(D,e,t),n(e,ze,t),n(e,q,t),n(e,Ie,t),n(e,Z,t),n(e,De,t),E(V,e,t),n(e,qe,t),n(e,K,t),Ze=!0},p:xt,i(e){Ze||(G(b.$$.fragment,e),G(M.$$.fragment,e),G(N.$$.fragment,e),G(H.$$.fragment,e),G(F.$$.fragment,e),G(D.$$.fragment,e),G(V.$$.fragment,e),Ze=!0)},o(e){B(b.$$.fragment,e),B(M.$$.fragment,e),B(N.$$.fragment,e),B(H.$$.fragment,e),B(F.$$.fragment,e),B(D.$$.fragment,e),B(V.$$.fragment,e),Ze=!1},d(e){e&&(a(Y),a(J),a(ee),a(te),a(y),a(ae),a(_),a(ne),a($),a(se),a(T),a(ie),a(le),a(k),a(re),a(f),a(oe),a(o),a(ye),a(R),a(_e),a($e),a(d),a(Te),a(u),a(Me),a(L),a(ke),a(Re),a(P),a(Ne),a(C),a(Le),a(He),a(S),a(Pe),a(j),a(Ce),a(c),a(Fe),a(z),a(Se),a(I),a(je),a(ze),a(q),a(Ie),a(Z),a(De),a(qe),a(K)),a(w),U(b,e),U(M,e),U(N,e),U(H,e),U(F,e),U(D,e),U(V,e)}}}const kt='{"title":"Novel View Synthesis","local":"novel-view-synthesis","sections":[{"title":"PixelNeRF","local":"pixelnerf","sections":[{"title":"Results (from the PixelNeRF website)","local":"results-from-the-pixelnerf-website","sections":[],"depth":3},{"title":"Related methods","local":"related-methods","sections":[],"depth":3}],"depth":2},{"title":"Zero123 (or Zero-1-to-3)","local":"zero123-or-zero-1-to-3","sections":[{"title":"Related methods","local":"related-methods","sections":[],"depth":3}],"depth":2}],"depth":1}';function Rt(Ge){return bt(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Pt extends yt{constructor(w){super(),_t(this,w,Rt,Mt,vt,{})}}export{Pt as component};
