
\section{Appendix}

This section is organised as follows:
\begin{enumerate}
   
    \item Implementation Details
    \item Additional Results
    \item Limitations
\end{enumerate}





\subsection{Implementation Details}

\textbf{Language-Guided Multi-head Attention.} We use multi-head attention with 4 heads. We pass the Image Encoding as the Query and the Text Encoding as the Key and Value. 

\textbf{Frame-Scoring Transformer.} We use a Transformer with 8 heads, 6 encoder layers and 6 decoder layers. The length of the sequence passed as input to the Transformer was heuristically chosen as 256.   

\textbf{Image Encoding.} We encode the image using the CLIP~\cite{radford2021learning} Image encoder to obtain image encoding  $f_{img}(F) \in \mathbb{R}^{512}$. 

\textbf{Text Encoding.} For query-focused video summaries, we encode the query using the CLIP Text encoder to obtain text embedding $f_{text}(C) \in\mathbb{R}^{512}$. For generic video summaries, we first generate dense video description using BMT~\cite{iashin2020better} by sampling frames from the input video at 2 fps. For a 2-3 min video BMT generates ~10-15 sentences. Next, we uniformly sample 7 sentences from the dense description corresponding to different video segments over time. Each sentence is then encoded using CLIP text encoder and the 7 embeddings are concatenated to obtain a feature vector. This is passed through a linear layer to obtain the input text embedding. Heuristically, we found that sampling 7 captions worked best for TVSum and SumMe datasets where the average duration of the videos is ~2 mins. For generic summarization on the QFVS dataset (day long videos) reported above, the frames are extracted at 2 FPS and pass this through the BMT pipeline. This generates roughly 20 sentences and we then sampled 15 captions for each video since the videos are significantly longer.

Next, we uniformly sample $M$ captions from the dense description corresponding to different video segments over time. Each caption is then encoded using CLIP Text encoder and the $M$ embeddings are concatenated to obtain a feature vector in ${R}^{M X 512}$. This is passed through a linear layer to obtain $f_{text}(C) \in\mathbb{R}^{512}$. We find that $M=7$ works best.  

\begin{table*}[ht]
\centering
\caption{
Kendall's $\tau$~\cite{Kendall} and Spearman's $\rho$~\cite{Spearman} correlation coefficients computed on the TVSum benchmark~\cite{Song15}.}
\begin{tabular}{lccc}\toprule
    Method & Kendall's $\tau$ &  Spearman's $\rho$ \tabularnewline
    \midrule
    Zhang \emph{\emph{et al}\ifx\@let@token.\else.\null\fi\xspace}~\cite{Zhang16} & 0.042 & 0.055 \tabularnewline
    Zhou \emph{\emph{et al}\ifx\@let@token.\else.\null\fi\xspace}~\cite{Zhou18} & 0.020 &  0.026 \tabularnewline
    Park \emph{\emph{et al}\ifx\@let@token.\else.\null\fi\xspace}(SumGraph)~\cite{park2020sumgraph} & 0.094 & 0.138 \tabularnewline
    \midrule
    \textbf{CLIP-It} & \textbf{0.108} & \textbf{0.147}\tabularnewline
    \midrule
    Human & 0.177 & 0.204 \tabularnewline
    \bottomrule
    \end{tabular}
\label{tab:4}
\end{table*}

\textbf{Training.} Note that the caption generator, image and text encoders are kept fixed. The Language-Guided Multi-Headed Attention network and the Frame-Scoring Transformer are trained using Adam optimizer and a learning rate of 1e-4 and weight decay of 0.001.  

\textbf{Computational Resources.} For each dataset and data setting, we train our method for 20 epochs with a batch size of 100 which takes about 2-3 hours on 5 NVIDIA RTX 2080 GPUs. 

\textbf{Frame Scores to Shot Scores.} 
For Generic Video Summarization, different datasets provide ground-truth annotations in different formats. Following ~\cite{Zhang16CVPR, Zhang16}, we obtain a single set of ground-truth keyframes (small subset of isolated frames) for each video. If a frame is selected to be a part of the summary, it is labeled 1, otherwise 0. The model is trained using keyframe annotations but evaluated on keyshots (interval-based subset of frames). For fair comparison, we follow~\cite{Zhang16CVPR, Zhang16, Rochan18} to convert the keyframes to keyshots.  

For Query-Focused Video Summarization, the video is divided into shots of 5 seconds each~\cite{sharghi2016query}. Ground-truth annotations are available for each shot. While prior work predicts a single score per shot, we predict scores for each frame in the shot. In order to combine the scores for all frames in a shot we use two strategies: taking the max and taking the average. We found that taking the average of scores assigned to all frames in a shot to determine the shot score works best. 


\subsection{Additional Results}
We also follow Otani \emph{et al}\ifx\@let@token.\else.\null\fi\xspace~\cite{Otani19} and report results on rank based metrics, Kendall's $\tau$~\cite{Kendall} and Spearman's $\rho$~\cite{Spearman} correlation coefficients in the Tab.~\ref{tab:4} for TVSum. They are computed by first ranking the frames in the video based on the predicted scores and the ground-truth scores and then comparing the two rankings. The correlation scores are computed by averaging over the individual results. We outperform all the baselines on these metrics as well. 

\begin{table*}[ht]
    \centering
    \caption{F1 scores of \textbf{CLIP-It} for different loss ablations.}
    \begin{tabular}{lcccccc}\toprule
\multirow{2}{*}{Method} & \multicolumn{3}{c}{SumMe}  & \multicolumn{3}{c}{TVSum}     \\ \cmidrule(l{2pt}r{2pt}){2-4} \cmidrule(l{2pt}r{2pt}){5-7}
                        & Standard & Augment & Transfer & Standard & Augment & Transfer \\ \midrule
    $\mathcal{L}_{c}$ & 49.1 & 52.6 & 46.2 & 60.2 & 61.7 & 57.3 \tabularnewline
    $\mathcal{L}_{c} + \mathcal{L}_{r}$ & 53.0 & 55.4 & 50.3 & 64.5 & 66.5 & 63.4 \tabularnewline
    $\mathcal{L}_{c} + \mathcal{L}_{d}$ & 53.7 & 55.8 &  50.8 & 65.4 & 67.6 & 64.3\tabularnewline
    $\mathcal{L}_{unsup} = \mathcal{L}_{d} + \mathcal{L}_{r}$ & 52.5 & 54.7 & 50.0 & 63.0 & 65.7 & 62.8 \tabularnewline
    $\mathcal{L}_{sup} = \mathcal{L}_{c} + \mathcal{L}_{d} + \mathcal{L}_{r}$ & 54.2 & 56.4 & 51.9 & 66.3 & 69.0 & 65.5 \tabularnewline
    \bottomrule
    \end{tabular}
    \label{tab:loss_ablations}
\end{table*}

\begin{table*}[ht]
    \centering
    \small
    \caption{Ablating the Cross-Modal Attention module.}
    \begin{tabularx}{\textwidth}{lXXXXXX}\toprule
    \multirow{2}{*}{Method} & \multicolumn{3}{c}{SumMe}     & \multicolumn{3}{c}{TVSum}     \\ \cmidrule(l{2pt}r{2pt}){2-4} \cmidrule(l{2pt}r{2pt}){5-7}
                            & Standard & Augment & Transfer & Standard & Augment & Transfer \\ \midrule
    \textbf{CLIP-It} (MLP) & 50.6 & 51.08 & 48.1 & 63.0 & 65.8 & 61.4  \tabularnewline
    \textbf{CLIP-It} (Cross-Modal Attn) & 54.2 & 56.4 & 51.9 & 66.3 & 69.0 & 65.5  \tabularnewline
        \bottomrule
    \end{tabularx}
\label{tab:cma}
\end{table*}

In Tab.~\ref{tab:loss_ablations}, we ablate the different loss functions described in Sec.~3 of the main paper and report results on TVSum and SumMe datasets. $\mathcal{L}_{c}$ is the Classification loss, $\mathcal{L}_{r}$ is the Reconstruction loss, and $\mathcal{L}_{d}$ is the Diversity loss. Results shown are for the our full model, CLIP-It. Parameters $\alpha$, $\beta$, and $\lambda$ described in Sec.~3 are chosen heuristically and are set to 0.5, 0.3 and 0.2 respectively. 

As we see, the Classification loss alone yields the lowest F1 scores. Adding the Reconstruction or Diversity losses improves performance. However, in the unsupervised setting, as the ground truth annotations cannot be used, we remove the Classification loss. This causes a slight drop in performance. Our method works best in the supervised setting, when all three losses are combined.

In Table~\ref{tab:cma}, we verify the effectiveness of the language-guided attention block by replacing this block with a basic MLP. As seen, the performance drops by 4\% thus proving the need for the multi-headed attention between the two modalities. 
\subsection{Limitations}
As described, we use large scale language models for video captioning~\cite{iashin2020better} and feature extraction~(CLIP~\cite{radford2021learning}) which may have encoded some inappropriate biases that could propagate to our model. In particular, as CLIP was trained on 400M image-caption pairs sourced from the Web, we can not rule out the presence of biases or stereotypes which may propagate into how the video frames are scored within our method. 
\section{CLIP-It: Language-Guided Video Summarization}

\label{sec:approach}


CLIP-It is a unified \emph{language-guided} framework for both generic and query-focused video summarization. It takes an input video and a user-defined query or a system generated dense video caption and constructs a summary by selecting key frames from the video. First, we explain the intuition behind our approach. In the case of query-focused summarization, clearly, it is necessary to model the user query as input in order to produce an appropriate summary. In the case of generic video summarization no user query is available; nonetheless, we show here that we can leverage the semantic information contained in associated natural language descriptions to guide the summarization process. Assuming we had a generic description that accompanies a video (e.g., \emph{A person is walking a dog. The person throws a ball. The dog runs after it.}), we could leverage its semantic embedding to \emph{match it} to the most relevant portions of the video. Such a description could be obtained automatically by generating dense video captions~\cite{iashin2020better}. We first present an overview of our approach, CLIP-It, followed by a detailed description of the individual components.

\looseness=-1
\textbf{Overview.}
Our approach, CLIP-It, is outlined in Fig~\ref{fig:approach}. Given a video, we extract $N$ frames denoted by $F_i$,  $i \in [1, \dots N]$. We formulate the video summarization task as a per-frame binary classification problem. We embed the frames using a pretrained network $f_{img}$. If a query is provided (in the form of a natural language string), we embed the query using a pretrained network $f_{txt}$. Alternatively, as seen in the figure, we use an off-the-shelf video captioning model to generate a dense video caption with $M$ sentences denoted by $C_j$, $j \in [1, \dots M]$ and embed each sentence using the pretrained network $f_{txt}$. Next, we compute language attended image embeddings $I^{*}$ using learned Language-Guided Multi-head Attention $f^*_{img\_txt}$. Finally, we train a Frame-Scoring Transformer which assigns scores to each frame in the video (green indicating a high score and red indicating a low score). To construct the video summary during inference, we convert frame-level scores to shot-level scores and finally, use 0/1 knapsack algorithm to pick the key shots~\cite{Zhang16}. In the following, we describe the Language-Guided Attention and the Frame-Selection Transformer modules, followed by discussing the visual and language encoders.


\begin{figure*}[t]
    \centering
    \includegraphics[width=\textwidth]{figs/model.pdf}
    \caption{\textbf{Overview of CLIP-It.} 
    Given an input video, CLIP-It generates a summary conditioned on either a user-defined natural language query or an automatically generated dense video caption. The Language-Guided Attention head fuses the image and language embeddings and the Frame-Scoring Transformer jointly attends to all frames to predict their relevance scores. During inference, the video summary is constructed by converting frame scores to shot scores and using Knapsack algorithm to select high scoring shots.}
    \label{fig:approach}
    \vspace{-0.02in}
\end{figure*}

\textbf{Language-Guided Attention.}
We use Language-Guided Multi-head Attention to efficiently fuse information across the video and language modalities and to infer long-term dependencies across both.  Using a single attention head does not suffice as our goal is to allow all captions to attend to all frames in the video. We modify the Multi-Head Attention described in Vaswani~\emph{et al}\ifx\@let@token.\else.\null\fi\xspace~\cite{vaswani2017attention} to take in inputs from both modalities. We set Query $Q$, Key $K$, and Value $V$ as follows,
\begin{align*}
    Q &= f_{img}(F_i) \text{, where}~i \in [1, \dots N], \\
    K, V &= f_{txt}(C_j) \text{, where}~j \in [1, \dots M], \\
    \mathrm{Language}~\text{-}~\mathrm{Guided}~\mathrm{Attn.}(Q, K, V) &= \mathrm{Concat}(\mathrm{head_1}, ..., \mathrm{head_h})W^O,\\
    \text{where}~\mathrm{head_i} &= \mathrm{Attention}(QW^Q_i, KW^K_i, VW^V_i) \\
    \text{and}~\mathrm{Attention}(Q,K,V)&=\text{softmax}( \frac{QK^{T}}{\sqrt{d_k}})V
\end{align*}
$W^Q_i$, $W^K_i$, and $W^V_i$ are learned parameter matrices and $d_k$ is the dimensions of $K$. The output of the Language-Guided Multi-Head Attention are the attended image embeddings, denoted as $F_i^{'}$. 

\textbf{Frame-Scoring Transformer.} Finally, it is also important to ensure that we do not include redundant information, e.g., several key shots from the same event. To better model interactions across frames and contextualize them w.r.t. each other, we add a Frame-Scoring Transformer that takes image-text representations as input and outputs one score per frame. Based on the Transformer model~\cite{vaswani2017attention}, this module assigns relevance scores to the attended image embeddings $F_i^{'}$. We feed $F_i^{'}$ to the bottom of both the encoder and decoder stacks. Similar to~\cite{vaswani2017attention}, we use positional encoding to insert information about the relative positions of the tokens in the sequence. We add positional encodings to the input embeddings at the bottom of the encoder and decoder stacks.

\textbf{Image Encoding.} We encode the image using a pre-trained network $f_{img}$. We experiment with the following networks: GoogleNet~\cite{szegedy2015going}~(for a fair comparison to prior work), ResNet~\cite{he16}, and CLIP~\cite{radford2021learning}. 

\textbf{Text Encoding.} We encode the user-defined query or the system generated dense caption using a pre-trained network $f_{txt}$. In this case we tried the CLIP (ViT and RN101) model. In case of generic video summarization, we generate dense video captions for the \emph{whole video} in order to condition on language and incorporate added semantics into our video summarization pipeline. We use the Bi-Modal Transformer~\cite{iashin2020better} dense video captioning model that generates a multi-sentence description given a video with audio. Since there are multiple sentences in the dense video caption, we first embed each sentence of the caption using the text encoder $f_{txt}$ described above. They are then concatenated and fused using a multi-layer perceptron (MLP).

\subsection{Learning}
We employ 3 loss functions (classification, diversity, and reconstruction) to train our model. The supervised setting uses all 3 and the unsupervised setting uses only diversity and reconstruction losses. 
 
\textbf{Classification loss}. We use a weighted binary cross entropy loss for classifying each frame:
\begin{equation}\label{eq:Lg}
\mathcal{L}_{c} = -\frac{1}{N}\sum_{i=1}^{N}{w^{*}[ x^{*}_{i}\text{log}(x_i)]+(1-w^{*})[(1-x^{*}_{i})\text{log}(1-x_{i})]},
\end{equation}

where $x^{*}_{i}$ is the ground-truth label of the $i$-th frame and $N$ is the total number of frames in the video. $w^{*}$ is the weight assigned to the class $x^{*}_{i}$, which is set to $\frac{\#keyframes}{N}$ if $x^{*}_{i}$ is a keyframe and  $1-\frac{\#keyframes}{N}$ if $x^{*}_{i}$ is a background frame. 

For the purpose of training without any supervision, we employ two additional losses that enforce diversity in the selected keyframes. We first select keyframes $X$ based on the scores assigned by the Frame-Scoring Transformer. We pass the output features of the transformer model for the selected keyframes through a decoder network consisting of $1 \times 1$ convolution layers to obtain reconstructed feature vectors for the selected keyframes such that each keyframe feature vector is of the same dimension as its corresponding input frame-level feature vector. 

\textbf{Reconstruction Loss.} The reconstruction loss $\mathcal{L}_{r}$ is defined as the mean squared error between the reconstructed features and the original features corresponding to the selected keyframes, such that:
\begin{equation}
    \mathcal{L}_{r} = \frac{1}{X}\sum_{i\in X}{||\mathbf{x}_{i} - \hat{\mathbf{y}}_{i}||_{2}},
\end{equation}
where $\hat{\mathbf{y}}$ denotes the reconstructed features.

\textbf{Diversity Loss.} We employ a repelling regularizer~\cite{Zhao17} to enforce diversity among selected keyframes. Similar to~\cite{Rochan18,Rochan19}, we compute the diversity loss, $\mathcal{L}_{d}$, as the pairwise cosine similarity between the selected keyframes:
\begin{equation}\label{eq:diversity}
    \mathcal{L}_{d} = \frac{1}{X(X - 1)} \sum_{i \in X}\sum_{j \in X, j \neq i} \frac{\hat{\mathbf{y}}_{i} \cdot \hat{\mathbf{y}}_{j}}{||\hat{\mathbf{y}}_{i}||_{2}\cdot ||\hat{\mathbf{y}}_{j}||_{2}},
\end{equation}
where $\hat{\mathbf{y}_{i}}$ and $\hat{\mathbf{y}_{j}}$ denote the reconstructed feature vectors of the $i$-th and $j$-th node.

The final loss function for supervised learning is then,
\begin{equation}\label{equ:Lsup}
    \mathcal{L}_{sup} = \alpha \cdot \mathcal{L}_{c} + \beta  \cdot \mathcal{L}_{d} + \lambda \cdot \mathcal{L}_{r},
\end{equation}
where $\alpha$, $\beta$, and $\lambda$ control the trade-off between the three loss functions.
We modify the loss function to extend CLIP-It to the unsupervised video summarization setting. We omit $\mathcal{L}_{c}$ since the groundtruth summary cannot be used for supervision and represent the final loss function for unsupervised learning as:
\begin{equation}\label{equ:Lunsup}
    \mathcal{L}_{unsup} = \beta \cdot \mathcal{L}_{d} + \lambda \cdot \mathcal{L}_{r},
\end{equation}
where $\beta$ and $\lambda$ are balancing parameters to control the trade-off between the two terms. We include implementation details of our method in the Supp.



\section*{Checklist}

The checklist follows the references.  Please
read the checklist guidelines carefully for information on how to answer these
questions.  For each question, change the default \answerTODO{} to \answerYes{},
\answerNo{}, or \answerNA{}.  You are strongly encouraged to include a {\bf
justification to your answer}, either by referencing the appropriate section of
your paper or providing a brief inline description.  For example:
\begin{itemize}
  \item Did you include the license to the code and datasets? \answerYes{See Section~\ref{gen_inst}.}
  \item Did you include the license to the code and datasets? \answerNo{The code and the data are proprietary.}
  \item Did you include the license to the code and datasets? \answerNA{}
\end{itemize}
Please do not modify the questions and only use the provided macros for your
answers.  Note that the Checklist section does not count towards the page
limit.  In your paper, please delete this instructions block and only keep the
Checklist section heading above along with the questions/answers below.

\begin{enumerate}

\item For all authors...
\begin{enumerate}
  \item Do the main claims made in the abstract and introduction accurately reflect the paper's contributions and scope?
    \answerYes{}
  \item Did you describe the limitations of your work?
    \answerYes{See Supplemental}
  \item Did you discuss any potential negative societal impacts of your work?
    \answerYes{See Sec. 5}
  \item Have you read the ethics review guidelines and ensured that your paper conforms to them?
    \answerYes{}
\end{enumerate}

\item If you are including theoretical results...
\begin{enumerate}
  \item Did you state the full set of assumptions of all theoretical results?
    \answerNA{}
	\item Did you include complete proofs of all theoretical results?
    \answerNA{}
\end{enumerate}

\item If you ran experiments...
\begin{enumerate}
  \item Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)?
    \answerNo{We use public datasets. Code/models will be released soon.}
  \item Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)?
    \answerYes{See Supplemental.}
	\item Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)?
    \answerYes{See Supplemental.}
	\item Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)?
    \answerYes{See Supplemental.}
\end{enumerate}

\item If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
\begin{enumerate}
  \item If your work uses existing assets, did you cite the creators?
    \answerYes{See Sections 4.1 and 4.2.}
  \item Did you mention the license of the assets?
    \answerYes{See Sections 4.1 and 4.2.}
  \item Did you include any new assets either in the supplemental material or as a URL?
    \answerNo{}
  \item Did you discuss whether and how consent was obtained from people whose data you're using/curating?
    \answerYes{See Sections 4.1 and 4.2 and Supplemental.}
  \item Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content?
    \answerYes{See Supplemental.}
\end{enumerate}

\item If you used crowdsourcing or conducted research with human subjects...
\begin{enumerate}
  \item Did you include the full text of instructions given to participants and screenshots, if applicable?
    \answerNA{}
  \item Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable?
    \answerNA{}
  \item Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation?
    \answerNA{}
\end{enumerate}

\end{enumerate}


\section{Discussion and Broader Impacts}

\looseness=-1
We introduced CLIP-It, a unified language-guided framework for generic and query focused video summarization. Video summarization is a relevant problem with many use-cases, and our approach provides greater flexibility to the users, allowing them to guide summarization with open-ended natural language queries. We envision potential positive impact from improved user experience if adopted on video platforms such as YouTube. We rely on an off-the-shelf video captioning model~\cite{iashin2020better} and a large-scale vision-language model (CLIP~\cite{radford2021learning}) which may have encoded some inappropriate biases that could propagate to our model. Our visual inspection of the obtained summarization results did not raise any apparent concerns. However, practitioners who wish to use our approach should be mindful of the sources of bias we have outlined above depending on the specific use case they are addressing.

\textbf{Acknowledgements.} We thank Arun Mallya for very helpful discussions and
feedback. We'd also like to thank Huijuan Xu for feedback on the draft. This work was supported in part by DoD including DARPA’s XAI, LwLL, and SemaFor programs, as well as BAIR’s industrial alliance programs.


\section{Experiments}

\begin{table*}[t]
    \centering
    \small
    \caption{\textbf{Supervised.} Comparing F1 Scores of our methods with supervised baselines on the SumMe~\cite{Gygli14} and TVSum~\cite{Song15} datasets using Standard, Augment, and Transfer data configurations.}
    \begin{tabularx}{\textwidth}{lXXXXXX}\toprule
    \multirow{2}{*}{Method} & \multicolumn{3}{c}{SumMe}     & \multicolumn{3}{c}{TVSum} \\ 
    \cmidrule(l{2pt}r{2pt}){2-4} \cmidrule(l{2pt}r{2pt}){5-7}
                    & Standard & Augment & Transfer & Standard & Augment & Transfer \\ \midrule
        Zhang~\emph{et al}\ifx\@let@token.\else.\null\fi\xspace(SumTransfer)~\cite{Zhang16CVPR}    & 40.9    &   41.3    &  38.5    &  - &   -   &   -\tabularnewline
        Zhang~\emph{et al}\ifx\@let@token.\else.\null\fi\xspace(LSTM)~\cite{Zhang16}   & 38.6   &   42.9    &   41.8    &   54.7    &   59.6    &   58.7\tabularnewline
        Mahasseni~\emph{et al}\ifx\@let@token.\else.\null\fi\xspace(SUM-GAN$_{sup}$)~\cite{Mahasseni17}    & 41.7 &  43.6    &   -    & 56.3  &  61.2    & -   \tabularnewline
        Rochan~\emph{et al}\ifx\@let@token.\else.\null\fi\xspace(SUM-FCN)~\cite{Rochan18}   &  47.5  &  51.1   & 44.1    &   56.8   &   59.2     &   58.2\tabularnewline
        Rochan~\emph{et al}\ifx\@let@token.\else.\null\fi\xspace(SUM-DeepLab)~\cite{Rochan18} & 48.8   &    50.2   & 45.0      & 58.4  & 59.1 &  57.4 \tabularnewline
        Zhou~\emph{et al}\ifx\@let@token.\else.\null\fi\xspace~\cite{Zhou18} & 42.1 & 43.9  & 42.6  & 58.1  & 59.8  & 58.9 \tabularnewline
        Zhang~\emph{et al}\ifx\@let@token.\else.\null\fi\xspace~\cite{Zhang18} & - & 44.9 & - & - & 63.9 & -\tabularnewline
        Fajtl~\emph{et al}\ifx\@let@token.\else.\null\fi\xspace~\cite{accvw18} & 49.7   &    51.1   & -      & 61.4  & 62.4 &  - \tabularnewline
        Rochan~\emph{et al}\ifx\@let@token.\else.\null\fi\xspace~\cite{Rochan19} &  -   & 48.0  & 41.6 & -  &   56.1  & 55.7\tabularnewline
        Chen~\emph{et al}\ifx\@let@token.\else.\null\fi\xspace(V2TS)~\cite{chen2017video} & - & - & - & 62.1 & - & - \tabularnewline
        He~\emph{et al}\ifx\@let@token.\else.\null\fi\xspace~\cite{He19}    &   47.2   &   -    &   -   &   59.4   &   -    &   -   \tabularnewline
        Park~\emph{et al}\ifx\@let@token.\else.\null\fi\xspace(SumGraph)~\cite{park2020sumgraph} &  51.4 &  52.9 &  48.7    & 63.9   &    65.8   &  60.5  \tabularnewline \midrule
        GoogleNet+bi-LSTM & 38.5 & 42.4 & 40.7 &  53.9  &  59.6  &  58.6  \tabularnewline
        ResNet+bi-LSTM & 39.4  & 44.0 &  42.6 & 55.0 & 61.0 &  59.9  \tabularnewline
        CLIP-Image+bi-LSTM &  41.1 &  45.9 &  44.9  & 56.8 & 63.7 & 61.6  \tabularnewline
        CLIP-Image+Video Caption+bi-LSTM & 41.2  & 46.1  & 45.5  & 57.1  & 64.3 & 62.4  \tabularnewline
        GoogleNet+Transformer & 51.6 & 53.5 &  49.4  & 64.2  & 66.3  & 61.3  \tabularnewline
        ResNet+Transformer & 52.8 &  54.9 &  50.3    & 65.0   &  67.5 &  62.8  \tabularnewline
       
        CLIP-Image+Transformer &  53.5 &  55.3 &  51.0  & 65.5   &    68.1   &  63.4  \tabularnewline
        \textbf{CLIP-It}: CLIP-Image+Video Caption+Transformer &  \textbf{54.2} &  \textbf{56.4} &  \textbf{51.9}  & \textbf{66.3}   &    \textbf{69.0}   &  \textbf{65.5}  \tabularnewline
        \bottomrule
    \end{tabularx}  
\label{tab:1}
\end{table*}

In this section, we describe the experimental setup and evaluation of our method on two tasks: generic video summarization and query-focused video summarization.  

\subsection{Generic Video Summarization}
Generic video summarization involves generating a single general-purpose summary to describe the input video. Note that while prior works only use visual cues from the video, our method also allows for video captions as an input feature. For a fair comparison, we include ablations of our method that do not use any language cues and only the visual features used in earlier works~\cite{Zhang16}.

\looseness=-1
\textbf{Datasets.} We evaluate our approach on two standard video summarization datasets (TVSum~\cite{Song15} and SumMe~\cite{Gygli14}) and on the generic summaries for UT Egocentric videos~\cite{lee12} provided by the QFVS dataset~\cite{sharghi2017query}. TVSum~\cite{Song15} consists of 50 videos pertaining to 10 categories (how to videos, news, documentary, etc) with 5 videos from each category, typically 1-5 minutes in length. SumMe~\cite{Gygli14} consists of 25 videos capturing multiple events such as cooking and sports, and the lengths of the videos vary from 1 to 6 minutes. In addition to training on each dataset independently, we follow prior work and augment training data with 39 videos from the YouTube dataset~\cite{de11} and 50 videos from the Open Video Project (OVP) dataset~\cite{OVP}. YouTube dataset consists of news, sports and cartoon videos. OVP dataset consists of multiple different genres including documentary videos. These datasets are diverse in nature and come with different types of annotations, frame-level scores for TVSum and shot-level scores for SumMe. They are integrated to create the ground-truth using the procedure in~\cite{Zhang16}. The UT Egocentric dataset consists of 4 videos captured from head-mounted cameras. Each video is about 3-5 hours long, captured in a natural, uncontrolled setting and contains a diverse set of events. The QFVS dataset~\cite{sharghi2017query} provides ground-truth generic summaries for these 4 videos. The summaries were constructed by dividing the video into shots and asking 3 users to select the relevant shots. The final ground-truth is an average of annotations from all users. 

\textbf{Note.} All the datasets - YouTube~\cite{de11}, Open Video Project (OVP) dataset~\cite{OVP}, TVSum~\cite{Song15}, SumMe~\cite{Gygli14}, and QFVS~\cite{sharghi2016query} were collected by the creators (cited) and consent for any personally identifiable information (PII) was ascertained by the authors where necessary.

\textbf{Data configuration for TVSum and SumMe.} Following previous works~\cite{Zhang16, Zhang16CVPR, Rochan18, park2020sumgraph}, we evaluate our approach in three different data settings: Standard, Augment, and Transfer. In the Standard setting, the training and test splits are from the same dataset (i.e. either TVSum or SumMe). For SumMe we use available splits, and for TVSum we randomly select 20\% of the videos for testing and construct 5 different splits and report an average result on all 5 splits. For the Augment setting, the training set from one dataset (e.g., TVSum) is combined with all the data from the remaining three datasets (e.g., SumMe, OVP, and YouTube). This setting yields the best performing models due to the additional training data. The Transfer setting is the most challenging of the three. It involves training a model on three datasets and evaluating on the fourth unseen dataset.

\begin{table*}[t]
    \centering
    \small
    \caption{\textbf{Unsupervised.} Comparing F1 Scores of our methods with unsupervised baselines on the SumMe~\cite{Gygli14} and TVSum~\cite{Song15} datasets using Standard, Augment, and Transfer data configurations.}
    \begin{tabularx}{\textwidth}{lXXXXXX}\toprule
    \multirow{2}{*}{Method} & \multicolumn{3}{c}{SumMe}     & \multicolumn{3}{c}{TVSum}     \\ \cmidrule(l{2pt}r{2pt}){2-4} \cmidrule(l{2pt}r{2pt}){5-7}
                            & Standard & Augment & Transfer & Standard & Augment & Transfer \\ \midrule
        Mahasseni~\emph{et al}\ifx\@let@token.\else.\null\fi\xspace\cite{Mahasseni17}   & 39.1 &  43.4    &   -    & 51.7  &  59.5    & -   \tabularnewline
        Yuan~\emph{et al}\ifx\@let@token.\else.\null\fi\xspace\cite{Yuan2019} &  41.9 & - & - & 57.6    &   -    &   -\tabularnewline
        Rochan~\emph{et al}\ifx\@let@token.\else.\null\fi\xspace(SUM-FCN$_{unsup}$)~\cite{Rochan18}   &  41.5  &  -   & 39.5    &   52.7   &    -     &  -\tabularnewline
        Rochan~\emph{et al}\ifx\@let@token.\else.\null\fi\xspace~\cite{Rochan19}    &  47.5     &   -    & 41.6     & 55.6      &     -  &    55.7   \tabularnewline
        He~\emph{et al}\ifx\@let@token.\else.\null\fi\xspace\cite{He19}    &   46.0   &   47.0    &   44.5   &   58.5   &   58.9    &   57.8   \tabularnewline
        Park~\emph{et al}\ifx\@let@token.\else.\null\fi\xspace(SumGraph)~\cite{park2020sumgraph} &  49.8  & 52.1 &   47.0   &  59.3   &   61.2   &   57.6  \tabularnewline
        \midrule
        GoogleNet+bi-LSTM & 33.1 & 38.0 & 36.5 &  47.7  &  54.9  &  52.3  \tabularnewline
        ResNet+bi-LSTM & 34.5  & 40.1 &  39.6 & 51.0 & 56.2 &  53.8  \tabularnewline
        CLIP-Image+bi-LSTM &  35.7 &  41.0 &  41.4  & 52.8 & 58.7 & 56.0  \tabularnewline
        CLIP-Image+Video Caption+bi-LSTM & 36.9  & 42.4  & 42.5  & 53.5  & 59.4 & 57.6  \tabularnewline
        GoogleNet+Transformer & 50.0 & 52.7 &  47.6  & 59.9  & 62.1  & 58.4  \tabularnewline
        ResNet+Transformer & 50.8 &  53.9 &  49.3  & 61.1   &  63.0 &  59.9  \tabularnewline
       
        CLIP-Image+Transformer & 51.2  &  53.6 & 49.2 & 61.9  & 64.0 & 60.6 \tabularnewline
        \textbf{CLIP-It}: CLIP-Image+Video Caption+Transformer &  \textbf{52.5} &  \textbf{54.7} &  \textbf{50.0}  & \textbf{63.0}   &    \textbf{65.7}   &  \textbf{62.8}  \tabularnewline
        \bottomrule
    \end{tabularx}
\label{tab:2}
\end{table*}


\begin{table*}[t]
	\centering
	\caption{\small{Comparing F1 Scores for generic video summarization on the QFVS dataset.}}
	\begin{tabular}{lcccc|c}\toprule
		\textbf{Supervised} & Vid 1 & Vid 2 & Vid 3 & Vid 4 & {Avg} \\\midrule
		SubMod~\cite{Gygli15} & 49.51  & 51.03 & 64.52 & 35.82 & 50.22\\
		QFVS~\cite{sharghi2017query}  & 62.66 & 46.11 & 58.85 & 33.50 & 50.29 \\ \midrule
		CLIP-Image + bi-LSTM & 65.43 & 56.55 & 68.63 & 40.06 & 57.67\\
		ResNet + Transformer  & 66.97 & 58.32 & 70.10 & 43.31 & 59.67\\
		CLIP-Image + Transformer  & 70.8 & 61.67 & 72.43 & 47.48 & 63.11 \\
		\textbf{CLIP-It} (Gen. Caption) & 74.13 & 63.44 & 75.86 & 50.23 &  65.92 \tabularnewline
        \textbf{CLIP-It} (GT Caption) & 84.98  & 71.26  & 82.55  & 61.46 & 75.06 \tabularnewline
		\midrule\midrule
		\textbf{Unsupervised} & Vid 1 & Vid 2 & Vid 3 & Vid 4 & {Avg}\\\midrule
		Quasi~\cite{zhao2014quasi}  & 53.06 & 53.80 & 49.91 & 22.31 & 44.77 \\
		CLIP-Image + Transformer  & 65.44 & 57.21 & 65.10 & 41.63 & 57.35 \\
		\textbf{CLIP-It} (Gen. Caption) & 67.02 &  59.48 & 66.43 & 44.19 &  59.28 \tabularnewline
        \textbf{CLIP-It} (GT Caption) & 73.90 & 66.83 & 75.44 & 52.31 & 67.12 \tabularnewline
    \bottomrule
	\end{tabular}
	\label{table:qfvs_2}
\end{table*}

\begin{figure*}[t]
    \centering
    \includegraphics[width=\textwidth]{figs/q2.pdf}
    \caption{Comparison of ground-truth summary to results from CLIP-Image+Transformer and the full CLIP-It model (CLIP-Image+Video Caption+Transformer). The input is a recipe video. Without captions, the model assigns high scores to certain irrelevant frames such as scenes of the woman talking or eating which hurts the precision. With captions, the cross-attention mechanism ensures that frames with important actions and objects are assigned high scores.}
    \label{fig:q2}
\end{figure*}

\begin{figure*}[t]
    \centering
    \includegraphics[width=\textwidth]{figs/q1.pdf}
    \caption{Qualitative result comparing the generic summary from CLIP-It with the ground-truth summary. The plots showing predicted and ground-truth frame-level scores are similar, indicating that frames that were given a high score in ground-truth were also assigned high scores by our model. }
    \label{fig:q1}
\end{figure*}

\textbf{Quantitative Results.} We compare our method and its ablations to supervised video summarization baselines in Tab.\ref{tab:1}. We report F1 scores on the TVSum and SumMe datasets for all three data settings. Our full method, CLIP-It (CLIP-Image+Video Caption+Transformer), described in Sec.~\ref{sec:approach}, outperforms state-of-the-art by a large margin on all three settings. Particularly, in the Transfer setting we outperform the previous state-of-the-art SumGraph~\cite{park2020sumgraph} by ~5\% on TVSum and ~3\% on SumMe, indicating that our model is better than the baselines in generalizing to out-of-distribution data.

To prove the effectiveness of each component of our model, we include comparisons to different ablations. In CLIP-Image+Transformer, we ablate the Language-Guided Attention module and directly pass the CLIP-Image features as input to the transformer. As seen, the performance drops by ~2\% indicating that conditioning on CLIP language embeddings leads to better summaries. Substituting the Frame-Scoring Transformer with a Bidirectional LSTM in CLIP-Image+bi-LSTM and CLIP-Image+Video Caption+bi-LSTM again results in a performance drop, thus highlighting the need for the Transformer module in our model. For a fair comparison with the baselines, in GoogleNet+Transformer we use the same GoogleNet features provided by Zhang \emph{et al}\ifx\@let@token.\else.\null\fi\xspace~\cite{Zhang16} and \emph{used by all the other baselines} and do not include language features. This method still outperforms SumGraph~\cite{park2020sumgraph}. Replacing the GoogleNet features with ResNet features results in a small performance improvement but CLIP-Image features prove to be most effective. 

\looseness=-1
Tab.~\ref{tab:2} compares F1 scores in the unsupervised setting to other unsupervised baselines. CLIP-It (CLIP-Image+Video Caption+Transformer), outperforms the best performing baseline on all settings on both datasets. We again observe large performance improvements in the Transfer setting and notice that overall our unsupervised method performs almost as well as our supervised counterpart. In CLIP-Image+Transformer we ablate the language component which causes a drop in performance, thus proving that language cues are useful in the unsupervised setting as well. Other ablations yield similar results reiterating the need for each component of our method. We also follow Otani \emph{et al}\ifx\@let@token.\else.\null\fi\xspace~\cite{Otani19} and report results on rank based metrics, Kendall's $\tau$~\cite{Kendall} and Spearman's $\rho$~\cite{Spearman} correlation coefficients in the Supp. 

Tab.~\ref{table:qfvs_2} shows F1 scores for the generic setting on the QFVS Dataset~\cite{sharghi2017query}. Following~\cite{sharghi2017query}, we run four rounds of experiments leaving out one video for testing and one for validation, while keeping the remaining two for training. Our method, CLIP-It (Gen. Captions) outperforms both supervised and unsupervised baselines by a large margin on all four videos, and particularly on Video 4, which happens to be the most difficult for all methods. Adding captions helps significantly improve (~2\%) the summaries and outperforms the CLIP Image + Transformer baseline. To see how well our model would perform if we had perfect captions, we also show results by using the ground-truth captions obtained from VideoSet~\cite{yeung2014videoset}. Replacing CLIP-Image features with ResNet features causes a drop in performance. Likewise, replacing the Transformer with a bi-LSTM also hurts performance.

We include results of our method (1) without captions (2) using generated captions (3) using the ground truth captions provided by VideoSet~\cite{yeung2014videoset} for UT Egocentric and TV Episodes datasets in Tables~\ref{tab:ute} and \ref{tab:tve}. As ground truth, we obtain 15 summaries for each video using the same greedy n-gram matching and ordered subshot selection procedures as previous work~\cite{plummer2017enhancing}. We follow the same procedure as in prior work~\cite{yeung2014videoset,plummer2017enhancing} for creating and evaluating text summaries from video summaries. Our method outperforms~\cite{plummer2017enhancing} in both the supervised and unsupervised settings on both datasets.

\begin{table*}[t]
\centering
\caption{
Results on UT Egocentric dataset~\cite{lee12}}
\begin{tabular}{lccc}\toprule
    Method & F-Measure  &  Recall \tabularnewline
    \midrule
    Supervised & & \tabularnewline
    \midrule
    Submod-V+Both \emph{\emph{et al}\ifx\@let@token.\else.\null\fi\xspace}~\cite{plummer2017enhancing} & 34.15 & 31.59 \tabularnewline
    CLIP Image + Transformer  & 41.58 &  39.96 \tabularnewline
    \textbf{CLIP-It}: CLIP Image + Gen. Video Caption + Transformer  & 44.70 &  43.28 \tabularnewline
    \textbf{CLIP-It}: CLIP Image + GT Video Caption + Transformer  & 52.10 &  50.76 \tabularnewline
    \midrule
    Unsupervised & & \tabularnewline
    \midrule
    CLIP Image + Transformer  & 39.22 &  37.46 \tabularnewline
    \textbf{CLIP-It}: CLIP Image + Gen. Video Caption + Transformer  & 42.10 &  40.65 \tabularnewline
    \textbf{CLIP-It}: CLIP Image + GT Video Caption + Transformer  & 49.98 &  47.91
    \tabularnewline
    \bottomrule
    \end{tabular}
\label{tab:ute}
\end{table*}

\begin{table*}[t]
\centering
\caption{
Results on TV Episodes dataset~\cite{lee12}}
\begin{tabular}{lccc}\toprule
    Method & F-Measure &  Recall  \tabularnewline
    \midrule
    Supervised & & \tabularnewline
    \midrule
    Submod-V+Sem. Rep. \emph{\emph{et al}\ifx\@let@token.\else.\null\fi\xspace}~\cite{plummer2017enhancing} & 40.90 & 37.02 \tabularnewline
    CLIP Image + Transformer  & 47.82 &  46.02 \tabularnewline
    \textbf{CLIP-It}: CLIP Image + GT Video Caption + Transformer  & 55.34 &  53.90 \tabularnewline
    \midrule
    Unsupervised & & \tabularnewline
    \midrule
    CLIP Image + Transformer  & 45.77 &  44.01 \tabularnewline
    \textbf{CLIP-It}: CLIP Image + GT Video Caption + Transformer  & 53.42 &  52.50
    \tabularnewline
    \bottomrule
    \end{tabular}
\label{tab:tve}
\end{table*}



\begin{figure*}[t]
    \centering
    \includegraphics[width=\textwidth]{figs/q3.pdf}
    \caption{Result of our method on the QFVS dataset. The first row shows some frames from the 4 hour long input video. Given the query "book and chair", Summary 1 shows some frames selected by our method. Summary 2 shows frames for the query "Sun and Tree".}
    \label{fig:q3}
\end{figure*}


\begin{table*}
	\centering
	\caption{\small{Comparing F1 Scores of different methods on the QFVS dataset.}}
	\begin{tabular}{lcccc|c}\toprule
		& Vid 1 & Vid 2 & Vid 3 & Vid 4 & \textbf{Avg} \\\midrule
		SeqDPP~\cite{gong14} & 36.59  & 43.67 & 25.26 & 18.15 & 30.92\\
		SH-DPP~\cite{sharghi2016query}  & 35.67 & 42.74 & 36.51 & 18.62 & 33.38 \\
		QFVS~\cite{sharghi2017query}  & 48.68 & 41.66 & 56.47 & 29.96 & 44.19 \\ \midrule
		CLIP-Image + Query + bi-LSTM & 54.47 & 48.59 & 62.81 & 38.64 & 51.13\\
		ResNet + Query + Transformer  & 55.19 & 51.03 & 64.26 & 39.47 & 52.49\\
		\textbf{CLIP-It}: CLIP-Image + Query + Transformer  & \textbf{57.13} & \textbf{53.60} & \textbf{66.08} & \textbf{41.41} & \textbf{54.55} \\
    \bottomrule
	\end{tabular}
	\label{table:qfvs_1}
\end{table*}


\textbf{Qualitative Results.} We highlight the need to use language, specifically dense video captions, for constructing generic video summaries through a qualitative example in Fig.~\ref{fig:q2}. The input is a video of a woman demonstrating how to make a chicken sandwich. The ground truth summary shows the scores computed by averaging the annotations from all users as in~\cite{Zhang16} and the keyframes that received high scores. Next we show the result from the baseline CLIP-Image+Transformer, which uses only visual features and \emph{no language input}. The predicted scores show that the high scoring frames in the ground truth also receive a high score by our baseline, however a lot of irrelevant frames end up receiving a high score too. Thus, when the model finally picks the keyframes it ends up selecting frames where the person is talking or eating the sandwich (shown in red) which do not correspond to the key steps in the video. Adding language guidance via generated captions helps address this problem. The last row shows the captions generated by BMT~\cite{iashin2020better}. The results shown are from our full CLIP-It model. The predicted scores are more similar to ground truth scores and the highest scoring keyframes are the same as the ground truth. 

Fig.~\ref{fig:q1} shows compares summaries generated by our method to the ground truth summary on a cooking video from the SumMe dataset. Predicted scores are the frame-wise scores predicted by CLIP-It and GT Scores are the scores computed from user annotations~\cite{Zhang16}. The top row (True Positives) shows high scoring keyframes which are chosen by both our method and the ground truth, and the green arrows point to the assigned scores. As we see, they are clear, distinct and represent key actions in the recipe. The bottom row (True Negatives) shows frames which are assigned a low score (shown by the red arrows) and are not part of the final summaries (both GT and predicted). E.g., the first frame is irrelevant and corresponds to a segment between key steps, while the second frame has poor lighting and its hard to tell what is being done. 

\subsection{Query-Focused Video Summarization} 
In Query-Focused Video Summarization, the summarization process is conditioned on an input user query, thus, multiple summaries can be obtained for the same video using different input queries. 

\looseness=-1
\textbf{Dataset.} We evaluate our method on the QFVS dataset based on the UT Egocentric videos described earlier. The dataset consists of 46 queries for each of the four videos and user-annotated video summaries for each query.  

\textbf{Quantitative Results.} In Tab.~\ref{table:qfvs_1}, we compare F1 scores of our method to 3 baselines, SH-DPP~\cite{sharghi2016query}, Seq-DPP~\cite{gong14}, and QFVS~\cite{sharghi2017query}. Following~\cite{sharghi2017query}, we run four rounds of experiments leaving out one video for testing and one for validation, while keeping the remaining two for training. Our full model achieves an avg F1 score of 54.55\% outperforming the best baseline (44.19\%) by 10\%. We would like to point out that our method uses more recent image features compared to the baselines. At the same time, when switching from CLIP to ResNet image embedding, we still improve significantly over the baselines. We expect the improvement to also hold with weaker features (e.g., as demonstrated with GoogleNet results in Tab.~\ref{tab:1}, \ref{tab:2}).


\textbf{Qualitative Results.} Fig.~\ref{fig:q3} shows a result on the QFVS dataset for UT Egocentric videos. The input is an egocentric video shot from a head-mounted camera and spans 4 hours. It consists of multiple events from a person's day, such as reading books, working on the laptop, walking in the streets, and so on. Summary 1 and 2 show results from our CLIP-It method when the input query is ``Book and chair'' and ``Sun and tree'' respectively. The frames shown are frames assigned high-scores by our method. As seen, given the same input video, different queries yield different summaries. 









\section{Introduction}

An effective video summary captures the essence of the video and provides a quick overview as an alternative to viewing the whole video; it should be succinct yet representative of the entire video. Summarizing videos has many use cases - for example, viewers on YouTube may want to watch a short summary of the video to assess its relevance. While a generic summary is useful for capturing the important scenes in a video, it is even more practical if the summary can be customized by the user. As seen in Fig.~\ref{fig:teaser}, users should be able to indicate the concepts of the video they would like to see in the summary using natural language queries.


Generic video summarization datasets such as TVSum~\cite{Song15} and SumMe~\cite{Gygli14} provide ground-truth annotations in the form of frame or shot-level importance scores specified by multiple annotators.
Several learning-based methods reduce the task to a frame-wise score prediction problem. Sequence labeling methods~\cite{gong14,  Zhang16CVPR, Zhang16, Zhang18, li2018local} model variable-range dependencies between frames but fail to capture relationships across all frames simultaneously. While attention~\cite{accvw18} and graph based~\cite{park2020sumgraph} methods address this partly, they disregard ordering of the input frames which is useful when predicting scores. Moreover, these methods use only visual cues to produce the summaries and cannot be customized with a natural language input. Another line of work, query-focused video summarization~\cite{sharghi2016query}, allows the users to customize the summary by specifying a query containing two concepts (eg., food and drinks). However, in their work the query can only be chosen from a fixed set of predefined concepts which limits the flexibility for the user. 


It is important to note that efforts in generic and query-focused video summarization have so far been disjoint, with no single method for both. Our key innovation is to unify these tasks in one \emph{language-guided} framework. We introduce \emph{CLIP-It}, a multimodal summarization model which takes two inputs, a video and a natural language text, and synthesizes a summary video conditioned on the text. In case of generic video summarization, the natural language text is a video description obtained using an off-the-shelf dense video captioning method. Alternatively, in the case of query-focused video summarization, the language input is a user-defined query. Unlike existing generic methods which only use visual cues, we show that adding language as an input leads to the ``discovery'' of relevant concepts and actions resulting in better summaries. Our method uses a Transformer with positional encoding, which can attend to all frames at once (unlike LSTM based methods) and also keep track of the ordering of frames (unlike graph based methods). In contrast to existing query-focused methods~\cite{sharghi2016query} which only allow  keyword based queries, we aim to enable open-ended natural language queries for users to customize video summaries. For example, as seen in Fig.~\ref{fig:teaser}, using our method users can specify long and descriptive queries such as, ``All water bodies such as lakes, rivers, and waterfalls'' which is not possible with previous methods.

\looseness=-1
Given an input video, CLIP-It generates a video summary guided by either a user-defined natural language query or a system generated description. It uses a \emph{Language-Guided Attention} head to compute a joint representation of the image and language embeddings, and a \emph{Frame-Scoring Transformer} to assign scores to individual frames in the video using the fused representations. Following~\cite{Zhang16, Zhang16CVPR}, the summary video is constructed from high scoring frames by converting frame-level scores to shot-level scores and using knapsack algorithm to fit the maximum number of high scoring shots in a timed window. Fig.~\ref{fig:teaser} shows an output from our method. Given an hour long video of a national park tour, we generate a 2 minute generic summary comprising of all the important scenes in the video. Given the two language queries, our method picks the matching keyframes in both cases. We can train CLIP-It without ground-truth supervision by leveraging the reconstruction and diversity losses~\cite{He19,Rochan18}. For generic video summarization, we evaluate our approach on the standard benchmarks, TVSum and SumMe. We achieve performance improvement on F1 score of nearly 3\% in the supervised setting and 4\% in the unsupervised setting on both datasets. We show large gains ($5\%$) in the Transfer setting, where CLIP-It is trained and evaluated on disjoint sets of data. For the query-focused scenario we evaluate on the QFVS dataset~\cite{sharghi2017query}, where we also achieve state-of-the-art results.

To summarize our contributions, we introduce CLIP-It, a \emph{language-guided} model that unifies generic and query-focused video summarization. Our approach uses language conditioning in the form of off-the-shelf video descriptions (for generic summarization) or user-defined natural language queries (for query-focused summarization). We show that the Transformer design enables effective contextualization across frames, benefiting our tasks. We also demonstrate the impact of language guidance on generic summarization. Finally, we establish the new state-of-the-art on both generic and query-focused datasets in supervised and unsupervised settings.

\section{Related Work}

\textbf{Generic Video Summarization.}
A video summary is a short synopsis created by stitching together important clips from the original video. Early works~\cite{ma2002model, smith1997video, smith1995video} referred to it as Video Skimming or Dynamic Video Summarization and used hand-designed features to generate summaries. Likewise, non-parametric unsupervised methods~\cite{kang06, lee12, ngo03, liu02, lu13, potapov14} used various heuristics to represent the importance of frames. Introduction of benchmark datasets such as TVSum~\cite{Song15} and SumMe~\cite{Gygli14} provided relevance scores for frames in videos annotated by users, resulting in multiple human generated summaries. This enabled automatic evaluation of video summarization techniques and has lead to the development of many supervised learning based methods~\cite{Gygli15, he16, Mahasseni17, park2020sumgraph, Rochan18, Rochan19,  Yuan2019, Zhang16CVPR, Zhang16, Zhang18, Zhao17}. These approaches capture high-level semantic information and outperform the heuristic unsupervised methods. Fully convolutional sequence networks~\cite{Rochan18} treat video summarization as a binary label prediction problem. Determinantal point processes~\cite{lavancier2015determinantal} and LSTM~\cite{hochreiter1997long} based approaches~\cite{gong14, li2018local, Zhang16CVPR, Zhang16, Zhang18} model variable-range dependencies between frames. However, these are sequential and fail to capture relationships across all frames simultaneously. Attention~\cite{accvw18} and graph based methods~\cite{park2020sumgraph} address this issue by modeling relationships across all frames, but they disregard the ordering of frames in a video, which is also useful for summarization. Our method uses a Transformer~\cite{vaswani2017attention} with positional encoding, which allows for joint attention across all frames while maintaining an ordering of the input sequence of frames. 

\looseness=-1
Some of the above works have supervised and unsupervised variants with modifications to the objective function. Specifically, for the unsupervised variant, they use reconstruction and diversity losses which do not require ground truth. We follow prior work in terms of using the same loss functions. Other notable unsupervised approaches include an adversarial LSTM based method~\cite{Mahasseni17}, a generative adversarial network to learn from unpaired data~\cite{Rochan19}, and a cycle consistent learning objective~\cite{Yuan2019}. 

\textbf{Video-Text Summarization.} Plummer~\emph{et al}\ifx\@let@token.\else.\null\fi\xspace~\cite{plummer2017enhancing} use image-language embeddings for generating video summaries but evaluate their approach in the text domain, and not on the generic video summarization benchmarks. Furthermore, they require text to be provided as input and don't have a mechanism to generate captions if absent. On the other hand, our method works well with off-the-shelf captions and we evaluate on both generic and query-focused benchmark datasets. Chen~\emph{et al}\ifx\@let@token.\else.\null\fi\xspace~\cite{chen2017video} jointly train a text and video summarization network but rely on ground-truth text summaries. 

\textbf{Query-Focused Video Summarization.} Oftentimes users browsing videos on YouTube are looking for something specific so a generic summary might not suffice. In this case, there should be an option to customize the generated summary using a natural language query. Sharghi~\emph{et al}\ifx\@let@token.\else.\null\fi\xspace~\cite{sharghi2016query} introduce the Query-Focused Video Summarization (QFVS) dataset for UT Egocentric~\cite{lee12} videos containing user-defined video summaries for a set of pre-defined concepts. Sharghi~\emph{et al}\ifx\@let@token.\else.\null\fi\xspace~\cite{sharghi2017query} propose a memory network to attend over different video frames and shots with the user query as input. However, this recurrent attention mechanism precludes parallelization and limits modeling long-range dependencies, which is overcome by our Transformer architecture. Moreover, their method only works with the pre-defined set of keyword based queries in QFVS dataset. Since we use CLIP~\cite{radford2021learning} to encode the language input and train our method on dense video descriptions, this allows users to define freeform queries at test time (as seen in Fig.~\ref{fig:teaser}). Other works~\cite{kanehira2018aware,wei2018video} similarly condition the summary generation on keyword based queries but haven't released their data.

\textbf{Transformers.} Transformers~\cite{vaswani2017attention} were introduced for neural machine translation and have since been applied to video-language tasks such as video-retrieval~\cite{gabeur2020multi} and video captioning~\cite{lei2020mart, zhou2018end}. In this work we adapt transformers for video summarization. We modify self-attention~\cite{vaswani2017attention} to a Language-Guided Attention block that accepts inputs from two modalities. Additionally, our method also relies on CLIP~\cite{radford2021learning} for extracting image and text features and a Bi-Modal Transformer~\cite{iashin2020better} for dense video caption generation, both of which also have transformer backbone. 




