import{s as bt,n as Nt,o as _t}from"../chunks/scheduler.35aab934.js";import{S as Ht,i as kt,e as o,s,c as p,q as St,h as Rt,a as l,d as n,b as a,f as Ct,g as m,j as r,r as qt,k as se,l as Pt,m as i,n as d,t as f,o as u,p as c}from"../chunks/index.de17b971.js";import{C as It}from"../chunks/CopyLLMTxtMenu.48bc5cc2.js";import{H as h,E as Vt}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.8fdece89.js";function Et(Qe){let g,le,ae,re,L,pe,y,me,M,de,x,Xe=`Videos are made up of a series of images called frames that are played one after another to create motion. Each frame captures spatial information — the objects and scenes in the image. When these frames are shown in sequence, they also provide temporal information — how things change and move over time.
Because of this combination of space and time, videos contain more complex information than single images. To analyze videos effectively, we need models that can understand both the spatial and temporal aspects.`,fe,C,ue,v,Ze='<img src="https://huggingface.co/datasets/hf-vision/course-assets/resolve/main/rnn_video_models/rnn.png" alt="RNN architecture"/>',ce,b,he,N,et=`In video analysis, it’s important to consider both spatial (space) and temporal (time) features together—this is called spatio-temporal modeling. Spatial modeling looks at what’s in each frame, like objects or people, while temporal modeling looks at how these things change from frame to frame.
By combining these two, we can understand the full context of a video. Techniques like combining CNNs and RNNs or using special types of convolutions that capture both space and time are ways researchers achieve this.`,ge,_,ve,H,Te,T,tt='<img src="https://huggingface.co/datasets/hf-vision/course-assets/resolve/main/rnn_video_models/lrcn.png" alt="LRCN model architecture"/>',$e,k,nt=`<strong>Overview</strong>
Long-term Recurrent Convolutional Networks (LRCN) are models introduced by researchers Donahue et al. in 2015.
They combine CNNs and Long Short-Term Memory networks (LSTMs), a type of RNN, to learn from both the spatial and temporal features in videos.
The CNN processes each frame to extract spatial features, and the LSTM takes these features in sequence to learn how they change over time.`,we,S,it="<strong>Key Features</strong>",Le,R,st="<li><strong>Combining CNN and LSTM:</strong> Spatial features from each frame are fed into the LSTM to model the temporal relationships.</li> <li><strong>Versatile Applications:</strong> LRCNs have been used successfully in tasks like action recognition (identifying actions in videos) and video captioning (generating descriptions of videos).</li>",ye,q,at=`<strong>Why It Matters</strong>
LRCN was one of the first models to effectively handle both spatial and temporal aspects of video data. It paved the way for future research by showing that combining CNNs and RNNs can be powerful for video analysis.`,Me,P,xe,$,ot='<img src="https://huggingface.co/datasets/hf-vision/course-assets/resolve/main/rnn_video_models/convlstm.png" alt="ConvLSTM model architecture"/>',Ce,I,lt="<strong>Overview</strong>",be,V,rt="The Convolutional LSTM Network (ConvLSTM) was proposed by Shi et al. in 2015. It modifies the traditional LSTM by incorporating convolutional operations within the LSTM’s structure. This means that instead of processing one-dimensional sequences, ConvLSTM can handle two-dimensional spatial data (like images) over time.",Ne,E,pt="<strong>Key Features</strong>",_e,j,mt="<li><strong>Spatial Structure Preservation:</strong> By using convolutions, ConvLSTM maintains the spatial layout of the data while processing temporal sequences.</li> <li><strong>Effective for Spatio-Temporal Prediction:</strong> It’s particularly useful for tasks that require predicting how spatial data changes over time, such as weather forecasting or video frame prediction.</li>",He,D,dt=`<strong>Why It Matters</strong>
ConvLSTM introduced a new way to process spatio-temporal data by integrating convolution directly into the LSTM architecture. This has been influential in fields that need to predict future states based on spatial and temporal patterns.`,ke,z,Se,U,ft=`<strong>Overview</strong>
In 2015, Srivastava et al. introduced a method for learning video representations without labeled data, known as unsupervised learning. This paper utilizes a multi-layer LSTM model to learn video representations. The model consists of two main components: an Encoder LSTM and a Decoder LSTM. The Encoder maps video sequences of arbitrary length (in the time dimension) to a fixed-size representation. The Decoder then uses this representation to either reconstruct the input video sequence or predict the subsequent video sequence.`,Re,A,ut="<strong>Key Features</strong>",qe,B,ct="<li><strong>Unsupervised Learning:</strong> The model doesn’t require labeled data, making it easier to work with large amounts of video.</li>",Pe,O,ht=`<strong>Why It Matters</strong>
This approach showed that it’s possible to learn useful video representations without the need for extensive labeling, which is time-consuming and expensive. It opened up new possibilities for video analysis and generation using unsupervised methods.`,Ie,F,Ve,w,gt='<img src="https://huggingface.co/datasets/hf-vision/course-assets/resolve/main/rnn_video_models/attention_model.png"/>',Ee,W,vt=`<strong>Overview</strong>
In 2015, Yao et al. introduced attention mechanisms in video models, specifically for video captioning tasks. This approach leverages attention to selectively focus on important temporal and spatial features within the video, allowing the model to generate more accurate and contextually relevant descriptions.`,je,K,Tt="<strong>Key Features</strong>",De,G,$t="<li><strong>Temporal and Spatial Attention:</strong> The attention mechanism dynamically identifies the most relevant frames and regions in a video, ensuring that both local actions (e.g., specific movements) and global context (e.g., overall activity) are considered.</li> <li><strong>Enhanced Representation:</strong> By focusing on significant features, the model combines local and global temporal structures, leading to improved video representations and more precise caption generation.</li>",ze,Y,wt=`<strong>Why It Matters</strong>
Incorporating attention mechanisms into video models has transformed how temporal data is processed. This method enhances the model’s capacity to handle the complex interactions in video sequences, making it an essential component in modern neural network architectures for video analysis and generation.`,Ue,J,Ae,Q,Lt="<li><p><strong>Challenges with Long-Term Dependencies</strong></p> <p>RNNs, including LSTMs, can struggle to maintain information over long sequences. This means they might “forget” important details from earlier frames when processing long videos. This limitation can affect the model’s ability to understand the full context of a video.</p></li> <li><p><strong>Computational Complexity and Processing Time</strong></p> <p>Because RNNs process data sequentially—one step at a time—they can be slow, especially with long sequences like videos. This sequential processing makes it difficult to take advantage of parallel computing resources, leading to longer training and inference times.</p></li> <li><p><strong>Emergence of Alternative Models</strong></p> <p>Newer models like Transformers have been developed to address some of the limitations of RNNs. Transformers use attention mechanisms to handle sequences and can process data in parallel, making them faster and more effective at capturing long-term dependencies.</p></li>",Be,X,Oe,Z,yt="RNN-based models have significantly advanced the field of video analysis by providing tools to handle temporal sequences effectively. Models like LRCN, ConvLSTM, and those incorporating attention mechanisms have demonstrated the potential of combining spatial and temporal processing. However, limitations such as difficulty with long sequences, computational inefficiency, and high data requirements highlight the need for continued innovation.",Fe,ee,Mt="Future research is likely to focus on overcoming these challenges, possibly by adopting newer architectures like Transformers, improving training efficiency, and enhancing model interpretability. These efforts aim to create models that are both powerful and practical for real-world video applications.",We,te,Ke,ne,xt='<li><a href="https://arxiv.org/pdf/1411.4389" rel="nofollow">Long-term Recurrent Convolutional Networks paper</a></li> <li><a href="https://proceedings.neurips.cc/paper_files/paper/2015/file/07563a3fe3bbe7e3ba84431ad9d055af-Paper.pdf" rel="nofollow">Convolutional LSTM Network: A Machine Learning Approach for Precipitation Nowcasting paper</a></li> <li><a href="https://arxiv.org/pdf/1502.04681" rel="nofollow">Unsupervised Learning of Video Representations using LSTMs paper</a></li> <li><a href="https://arxiv.org/pdf/1502.08029" rel="nofollow">Describing Videos by Exploiting Temporal Structure paper</a></li>',Ge,ie,Ye,oe,Je;return L=new It({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),y=new h({props:{title:"Introduction",local:"introduction",headingTag:"h1"}}),M=new h({props:{title:"Videos as Sequence Data",local:"videos-as-sequence-data",headingTag:"h2"}}),C=new h({props:{title:"The Role and Need for RNNs in Video Processing",local:"the-role-and-need-for-rnns-in-video-processing",headingTag:"h2"}}),b=new h({props:{title:"Understanding Spatio-Temporal Modeling",local:"understanding-spatio-temporal-modeling",headingTag:"h2"}}),_=new h({props:{title:"RNN-Based Video Modeling Architectures",local:"rnn-based-video-modeling-architectures",headingTag:"h1"}}),H=new h({props:{title:"Long-term Recurrent Convolutional Networks(LRCN)",local:"long-term-recurrent-convolutional-networkslrcn",headingTag:"h2"}}),P=new h({props:{title:"Convolutional LSTM Network: A Machine Learning Approach for Precipitation Nowcasting(ConvLSTM)",local:"convolutional-lstm-network-a-machine-learning-approach-for-precipitation-nowcastingconvlstm",headingTag:"h2"}}),z=new h({props:{title:"Unsupervised Learning of Video Representations using LSTMs",local:"unsupervised-learning-of-video-representations-using-lstms",headingTag:"h2"}}),F=new h({props:{title:"Describing Videos by Exploiting Temporal Structure",local:"describing-videos-by-exploiting-temporal-structure",headingTag:"h2"}}),J=new h({props:{title:"Limitations of RNN-Based Models",local:"limitations-of-rnn-based-models",headingTag:"h1"}}),X=new h({props:{title:"Conclusion",local:"conclusion",headingTag:"h1"}}),te=new h({props:{title:"References",local:"references",headingTag:"h3"}}),ie=new Vt({props:{source:"https://github.com/huggingface/computer-vision-course/blob/main/chapters/en/unit7/video-processing/rnn-based-video-models.mdx"}}),{c(){g=o("meta"),le=s(),ae=o("p"),re=s(),p(L.$$.fragment),pe=s(),p(y.$$.fragment),me=s(),p(M.$$.fragment),de=s(),x=o("p"),x.textContent=Xe,fe=s(),p(C.$$.fragment),ue=s(),v=o("div"),v.innerHTML=Ze,ce=St(`
Convolutional Neural Networks (CNNs) are excellent at analyzing spatial features in images. 
However, they aren't designed to handle sequences where temporal relationships matter. This is where Recurrent Neural Networks (RNNs) come in. 
RNNs are specialized for processing sequential data because they have a "memory" that captures information from previous steps. This makes them well-suited for understanding how video frames relate to each other over time.
`),p(b.$$.fragment),he=s(),N=o("p"),N.textContent=et,ge=s(),p(_.$$.fragment),ve=s(),p(H.$$.fragment),Te=s(),T=o("div"),T.innerHTML=tt,$e=s(),k=o("p"),k.innerHTML=nt,we=s(),S=o("p"),S.innerHTML=it,Le=s(),R=o("ul"),R.innerHTML=st,ye=s(),q=o("p"),q.innerHTML=at,Me=s(),p(P.$$.fragment),xe=s(),$=o("div"),$.innerHTML=ot,Ce=s(),I=o("p"),I.innerHTML=lt,be=s(),V=o("p"),V.textContent=rt,Ne=s(),E=o("p"),E.innerHTML=pt,_e=s(),j=o("ul"),j.innerHTML=mt,He=s(),D=o("p"),D.innerHTML=dt,ke=s(),p(z.$$.fragment),Se=s(),U=o("p"),U.innerHTML=ft,Re=s(),A=o("p"),A.innerHTML=ut,qe=s(),B=o("ul"),B.innerHTML=ct,Pe=s(),O=o("p"),O.innerHTML=ht,Ie=s(),p(F.$$.fragment),Ve=s(),w=o("div"),w.innerHTML=gt,Ee=s(),W=o("p"),W.innerHTML=vt,je=s(),K=o("p"),K.innerHTML=Tt,De=s(),G=o("ul"),G.innerHTML=$t,ze=s(),Y=o("p"),Y.innerHTML=wt,Ue=s(),p(J.$$.fragment),Ae=s(),Q=o("ul"),Q.innerHTML=Lt,Be=s(),p(X.$$.fragment),Oe=s(),Z=o("p"),Z.textContent=yt,Fe=s(),ee=o("p"),ee.textContent=Mt,We=s(),p(te.$$.fragment),Ke=s(),ne=o("ol"),ne.innerHTML=xt,Ge=s(),p(ie.$$.fragment),Ye=s(),oe=o("p"),this.h()},l(e){const t=Rt("svelte-u9bgzb",document.head);g=l(t,"META",{name:!0,content:!0}),t.forEach(n),le=a(e),ae=l(e,"P",{}),Ct(ae).forEach(n),re=a(e),m(L.$$.fragment,e),pe=a(e),m(y.$$.fragment,e),me=a(e),m(M.$$.fragment,e),de=a(e),x=l(e,"P",{"data-svelte-h":!0}),r(x)!=="svelte-wxbrel"&&(x.textContent=Xe),fe=a(e),m(C.$$.fragment,e),ue=a(e),v=l(e,"DIV",{class:!0,"data-svelte-h":!0}),r(v)!=="svelte-r4beid"&&(v.innerHTML=Ze),ce=qt(e,`
Convolutional Neural Networks (CNNs) are excellent at analyzing spatial features in images. 
However, they aren't designed to handle sequences where temporal relationships matter. This is where Recurrent Neural Networks (RNNs) come in. 
RNNs are specialized for processing sequential data because they have a "memory" that captures information from previous steps. This makes them well-suited for understanding how video frames relate to each other over time.
`),m(b.$$.fragment,e),he=a(e),N=l(e,"P",{"data-svelte-h":!0}),r(N)!=="svelte-1ee8hml"&&(N.textContent=et),ge=a(e),m(_.$$.fragment,e),ve=a(e),m(H.$$.fragment,e),Te=a(e),T=l(e,"DIV",{class:!0,"data-svelte-h":!0}),r(T)!=="svelte-11gp7be"&&(T.innerHTML=tt),$e=a(e),k=l(e,"P",{"data-svelte-h":!0}),r(k)!=="svelte-1wfsy6s"&&(k.innerHTML=nt),we=a(e),S=l(e,"P",{"data-svelte-h":!0}),r(S)!=="svelte-1i4nuav"&&(S.innerHTML=it),Le=a(e),R=l(e,"UL",{"data-svelte-h":!0}),r(R)!=="svelte-7x3ry"&&(R.innerHTML=st),ye=a(e),q=l(e,"P",{"data-svelte-h":!0}),r(q)!=="svelte-grtv9c"&&(q.innerHTML=at),Me=a(e),m(P.$$.fragment,e),xe=a(e),$=l(e,"DIV",{class:!0,"data-svelte-h":!0}),r($)!=="svelte-1bdprdo"&&($.innerHTML=ot),Ce=a(e),I=l(e,"P",{"data-svelte-h":!0}),r(I)!=="svelte-9pdvmw"&&(I.innerHTML=lt),be=a(e),V=l(e,"P",{"data-svelte-h":!0}),r(V)!=="svelte-shehlv"&&(V.textContent=rt),Ne=a(e),E=l(e,"P",{"data-svelte-h":!0}),r(E)!=="svelte-1i4nuav"&&(E.innerHTML=pt),_e=a(e),j=l(e,"UL",{"data-svelte-h":!0}),r(j)!=="svelte-178xj27"&&(j.innerHTML=mt),He=a(e),D=l(e,"P",{"data-svelte-h":!0}),r(D)!=="svelte-zxpvg6"&&(D.innerHTML=dt),ke=a(e),m(z.$$.fragment,e),Se=a(e),U=l(e,"P",{"data-svelte-h":!0}),r(U)!=="svelte-1mcl1kx"&&(U.innerHTML=ft),Re=a(e),A=l(e,"P",{"data-svelte-h":!0}),r(A)!=="svelte-1i4nuav"&&(A.innerHTML=ut),qe=a(e),B=l(e,"UL",{"data-svelte-h":!0}),r(B)!=="svelte-8bzt2w"&&(B.innerHTML=ct),Pe=a(e),O=l(e,"P",{"data-svelte-h":!0}),r(O)!=="svelte-j0vs0g"&&(O.innerHTML=ht),Ie=a(e),m(F.$$.fragment,e),Ve=a(e),w=l(e,"DIV",{class:!0,"data-svelte-h":!0}),r(w)!=="svelte-sac4d2"&&(w.innerHTML=gt),Ee=a(e),W=l(e,"P",{"data-svelte-h":!0}),r(W)!=="svelte-mrhjwq"&&(W.innerHTML=vt),je=a(e),K=l(e,"P",{"data-svelte-h":!0}),r(K)!=="svelte-1i4nuav"&&(K.innerHTML=Tt),De=a(e),G=l(e,"UL",{"data-svelte-h":!0}),r(G)!=="svelte-1rlioj5"&&(G.innerHTML=$t),ze=a(e),Y=l(e,"P",{"data-svelte-h":!0}),r(Y)!=="svelte-1h6cy8g"&&(Y.innerHTML=wt),Ue=a(e),m(J.$$.fragment,e),Ae=a(e),Q=l(e,"UL",{"data-svelte-h":!0}),r(Q)!=="svelte-mkpo2k"&&(Q.innerHTML=Lt),Be=a(e),m(X.$$.fragment,e),Oe=a(e),Z=l(e,"P",{"data-svelte-h":!0}),r(Z)!=="svelte-phnkv7"&&(Z.textContent=yt),Fe=a(e),ee=l(e,"P",{"data-svelte-h":!0}),r(ee)!=="svelte-9wqcc4"&&(ee.textContent=Mt),We=a(e),m(te.$$.fragment,e),Ke=a(e),ne=l(e,"OL",{"data-svelte-h":!0}),r(ne)!=="svelte-12eejkb"&&(ne.innerHTML=xt),Ge=a(e),m(ie.$$.fragment,e),Ye=a(e),oe=l(e,"P",{}),Ct(oe).forEach(n),this.h()},h(){se(g,"name","hf:doc:metadata"),se(g,"content",jt),se(v,"class","flex justify-center"),se(T,"class","flex justify-center"),se($,"class","flex justify-center"),se(w,"class","flex justify-center")},m(e,t){Pt(document.head,g),i(e,le,t),i(e,ae,t),i(e,re,t),d(L,e,t),i(e,pe,t),d(y,e,t),i(e,me,t),d(M,e,t),i(e,de,t),i(e,x,t),i(e,fe,t),d(C,e,t),i(e,ue,t),i(e,v,t),i(e,ce,t),d(b,e,t),i(e,he,t),i(e,N,t),i(e,ge,t),d(_,e,t),i(e,ve,t),d(H,e,t),i(e,Te,t),i(e,T,t),i(e,$e,t),i(e,k,t),i(e,we,t),i(e,S,t),i(e,Le,t),i(e,R,t),i(e,ye,t),i(e,q,t),i(e,Me,t),d(P,e,t),i(e,xe,t),i(e,$,t),i(e,Ce,t),i(e,I,t),i(e,be,t),i(e,V,t),i(e,Ne,t),i(e,E,t),i(e,_e,t),i(e,j,t),i(e,He,t),i(e,D,t),i(e,ke,t),d(z,e,t),i(e,Se,t),i(e,U,t),i(e,Re,t),i(e,A,t),i(e,qe,t),i(e,B,t),i(e,Pe,t),i(e,O,t),i(e,Ie,t),d(F,e,t),i(e,Ve,t),i(e,w,t),i(e,Ee,t),i(e,W,t),i(e,je,t),i(e,K,t),i(e,De,t),i(e,G,t),i(e,ze,t),i(e,Y,t),i(e,Ue,t),d(J,e,t),i(e,Ae,t),i(e,Q,t),i(e,Be,t),d(X,e,t),i(e,Oe,t),i(e,Z,t),i(e,Fe,t),i(e,ee,t),i(e,We,t),d(te,e,t),i(e,Ke,t),i(e,ne,t),i(e,Ge,t),d(ie,e,t),i(e,Ye,t),i(e,oe,t),Je=!0},p:Nt,i(e){Je||(f(L.$$.fragment,e),f(y.$$.fragment,e),f(M.$$.fragment,e),f(C.$$.fragment,e),f(b.$$.fragment,e),f(_.$$.fragment,e),f(H.$$.fragment,e),f(P.$$.fragment,e),f(z.$$.fragment,e),f(F.$$.fragment,e),f(J.$$.fragment,e),f(X.$$.fragment,e),f(te.$$.fragment,e),f(ie.$$.fragment,e),Je=!0)},o(e){u(L.$$.fragment,e),u(y.$$.fragment,e),u(M.$$.fragment,e),u(C.$$.fragment,e),u(b.$$.fragment,e),u(_.$$.fragment,e),u(H.$$.fragment,e),u(P.$$.fragment,e),u(z.$$.fragment,e),u(F.$$.fragment,e),u(J.$$.fragment,e),u(X.$$.fragment,e),u(te.$$.fragment,e),u(ie.$$.fragment,e),Je=!1},d(e){e&&(n(le),n(ae),n(re),n(pe),n(me),n(de),n(x),n(fe),n(ue),n(v),n(ce),n(he),n(N),n(ge),n(ve),n(Te),n(T),n($e),n(k),n(we),n(S),n(Le),n(R),n(ye),n(q),n(Me),n(xe),n($),n(Ce),n(I),n(be),n(V),n(Ne),n(E),n(_e),n(j),n(He),n(D),n(ke),n(Se),n(U),n(Re),n(A),n(qe),n(B),n(Pe),n(O),n(Ie),n(Ve),n(w),n(Ee),n(W),n(je),n(K),n(De),n(G),n(ze),n(Y),n(Ue),n(Ae),n(Q),n(Be),n(Oe),n(Z),n(Fe),n(ee),n(We),n(Ke),n(ne),n(Ge),n(Ye),n(oe)),n(g),c(L,e),c(y,e),c(M,e),c(C,e),c(b,e),c(_,e),c(H,e),c(P,e),c(z,e),c(F,e),c(J,e),c(X,e),c(te,e),c(ie,e)}}}const jt='{"title":"Introduction","local":"introduction","sections":[{"title":"Videos as Sequence Data","local":"videos-as-sequence-data","sections":[],"depth":2},{"title":"The Role and Need for RNNs in Video Processing","local":"the-role-and-need-for-rnns-in-video-processing","sections":[],"depth":2},{"title":"Understanding Spatio-Temporal Modeling","local":"understanding-spatio-temporal-modeling","sections":[],"depth":2}],"depth":1}';function Dt(Qe){return _t(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Ot extends Ht{constructor(g){super(),kt(this,g,Dt,Et,bt,{})}}export{Ot as component};
