Riassunto analitico
L’Image captioning è il task che genera una descrizione testuale di un’immagine di input. In quanto tale, il task rappresenta la connessione tra Computer Vision e Natural Language Processing. I modelli standard implementano un’architettura encoder-decoder, addestrando un estrattore di features con l'aggiunta di un classificatore lineare che prevede l'assegnamento di una probabilità a ciascun token del vocabolario. L’innovazione di CLIP risiede nell’addestramento congiunto di un encoder di immagini e un encoder di testo per fornire gli accoppiamenti corretti tra immagine e testo. Lo scopo di questa tesi è migliorare la generazione delle didascalie, partendo da un discriminatore basato sull’architettura di CLIP e aumentando il numero di esempi testuali per rendere più elaborata la sua capacità di reasoning ed allineamento testo - immagine. L’idea di base è cercare, come CLIP, di minimizzare la contrastive loss in modo da associare l’immagine alla giusta descrizione e, allo stesso tempo, aggiungere degli esempi negativi per rendere il discriminatore ancora più efficiente nel distinguere le didascalie giuste da quelle sbagliate. Gli esempi negativi, utilizzati per addestrare il discriminatore, sono costruiti a partire dalle didascalie generate dal modello di Captioning, di cui viene fatto il fine-tuning in SCST considerando come reward il CLIP-Score. Gli esempi di negativi sono stati generati in diversi modi e poi usati per addestrare il modello. Per il fine-tuning del discriminatore, è stato utilizzato LoRA, un metodo che consente di gestire modelli linguistici di grandi dimensioni. Una volta allenato il discriminatore, il risultato viene utilizzato come reward del Captioner nella fase di fine-tuning in SCST. Questa ricerca ci ha permesso di raggiungere dei sostanziali miglioramenti nella generazione delle didascalie. Infatti, rispetto all'utilizzo di CLIP come discriminatore in SCST, il nostro modello, oltre a migliorarne il contenuto semantico, ottiene ottimi risultati in termini di grammatica e coerenza con l'immagine da descrivere.
|
Abstract
Image captioning is the task of generating textual description of an input image. As such, the task represents a trait d'union between Computer Vision and Natural Language Processing. Standard models implement an encoder-decoder architecture, training a feature extractor with the addition of a linear classifier that involves assigning a probability to each vocabulary token. CLIP’s innovation is in the joint training of an image encoder and a text encoder to provide the correct pairings between image and text. The purpose of this thesis is to improve the generation of captions, starting from a discriminator based on the CLIP architecture and increasing the number of textual samples to make more elaborate its ability to reasoning and align text-image. The basic idea is to try, like CLIP, to minimize the contrastive loss in order to associate the image to the right description and, at the same time, add negative samples to make the discriminator even more efficient in distinguishing the right captions from the wrong ones. The negative samples, used to train the discriminator, are built starting from the captions generated by the Captioning model, whose fine-tuning is done in SCST considering as reward the CLIP-Score. Samples of negatives were generated in different ways and then used to train the model. In order to fine-tuning the discriminator, LoRA was used, a method that allows to manage large-language models. Once the discriminator is trained, the result is used as reward for the Captioner in the fine-tuning phase in SCST.
This research has allowed us to achieve substantial improvements in the generation of captions. In fact, compared to the use of CLIP as a discriminator in SCST, our model, in addition to improving its semantic content, obtains excellent results in terms of grammar and consistency with the image to be described.
|