Ottimizzazione dell'Addestramento di ViViT: Riduzione del Tempo e della Memoria per il Riconoscimento delle Azioni
Optimizing ViViT Training: Time and Memory Reduction for Action Recognition
June 7, 2023
Autori: Shreyank N Gowda, Anurag Arnab, Jonathan Huang
cs.AI
Abstract
In questo articolo, affrontiamo le sfide poste dal tempo di addestramento sostanziale e dal consumo di memoria associati ai transformer per video, concentrandoci sul modello ViViT (Video Vision Transformer), in particolare sulla versione Factorised Encoder, come nostra baseline per i compiti di riconoscimento delle azioni. La variante del codificatore fattorizzato segue l'approccio di fusione tardiva adottato da molti metodi all'avanguardia. Nonostante si distingua per i suoi favorevoli compromessi velocità/accuratezza tra le diverse varianti di ViViT, il suo considerevole tempo di addestramento e i requisiti di memoria rappresentano ancora un significativo ostacolo all'adozione. Il nostro metodo è progettato per abbassare questa barriera e si basa sull'idea di congelare il transformer spaziale durante l'addestramento. Questo porta a un modello a bassa accuratezza se fatto in modo ingenuo. Ma dimostriamo che (1) inizializzando opportunamente il transformer temporale (un modulo responsabile dell'elaborazione delle informazioni temporali) e (2) introducendo un modello adattatore compatto che collega le rappresentazioni spaziali congelate (un modulo che si concentra selettivamente su regioni dell'immagine di input) al transformer temporale, possiamo godere dei vantaggi del congelamento del transformer spaziale senza sacrificare l'accuratezza. Attraverso un'ampia sperimentazione su 6 benchmark, dimostriamo che la nostra strategia di addestramento proposta riduce significativamente i costi di addestramento (di circa il 50%) e il consumo di memoria, mantenendo o migliorando leggermente le prestazioni fino all'1,79% rispetto al modello di baseline. Il nostro approccio consente inoltre di utilizzare modelli di transformer per immagini più grandi come nostro transformer spaziale e di accedere a più frame con lo stesso consumo di memoria.
English
In this paper, we address the challenges posed by the substantial training
time and memory consumption associated with video transformers, focusing on the
ViViT (Video Vision Transformer) model, in particular the Factorised Encoder
version, as our baseline for action recognition tasks. The factorised encoder
variant follows the late-fusion approach that is adopted by many state of the
art approaches. Despite standing out for its favorable speed/accuracy tradeoffs
among the different variants of ViViT, its considerable training time and
memory requirements still pose a significant barrier to entry. Our method is
designed to lower this barrier and is based on the idea of freezing the spatial
transformer during training. This leads to a low accuracy model if naively
done. But we show that by (1) appropriately initializing the temporal
transformer (a module responsible for processing temporal information) (2)
introducing a compact adapter model connecting frozen spatial representations
((a module that selectively focuses on regions of the input image) to the
temporal transformer, we can enjoy the benefits of freezing the spatial
transformer without sacrificing accuracy. Through extensive experimentation
over 6 benchmarks, we demonstrate that our proposed training strategy
significantly reduces training costs (by sim 50%) and memory consumption
while maintaining or slightly improving performance by up to 1.79\% compared to
the baseline model. Our approach additionally unlocks the capability to utilize
larger image transformer models as our spatial transformer and access more
frames with the same memory consumption.