## 2 Related Work
### Neural Networks for Image Captioning  
Describing the content of an image was a task that just a few years ago could only be accomplished by humans. However, advancements in computer vision have led to the creation of new systems capable of replicating this human behavior with impressive performance. The pioneering steps in this field are documented in works like [1], where the authors developed a probabilistic framework for generating descriptions from images. To achieve this goal, they devised an encoder-decoder structure employing neural networks. The primary function of the encoder is to process the input image, extracting meaningful features and encoding them into a format that can be easily understood by the neural network. In simpler terms, the encoder transforms the raw visual information of the image into a more abstract representation, highlighting important features. The decoder takes the encoded information from the encoder and generates a coherent and descriptive sequence. In the case of image captioning, this sequence comprises the natural language description of the image. The decoder essentially translates the encoded features back into human-readable language, allowing the system to generate meaningful and contextually relevant captions for the input images. Neural networks come in various types, each designed for specific tasks. Two prominent types are Convolutional Neural Networks (CNNs) and Recurrent Neural Networks (RNNs). CNNs are particularly well suited for image-related tasks. They utilize layers of convolutional operations to automatically extract hierarchical features from input images. CNNs are effective in recognizing spatial patterns, making them commonly used in image classification, object detection, and image segmentation tasks. On the other hand, RNNs are designed to handle sequential data and are well suited for tasks involving a sequence of inputs, such as time-series data or natural language. RNNs have memory units that allow them to capture dependencies and relationships within sequential data. This makes them suitable for tasks like language modeling, speech recognition, and sequence generation. Therefore, a good approach to addressing the problem of caption generation is the development of an encoder-decoder structure [14]. In this approach, a CNN is employed as the encoder, and an RNN serves as the decoder. This particular architecture has laid the groundwork for image captioning. In this process, the input image undergoes processing through the CNN to encode and extract features, which are then embedded into a fixed-length vector. This fixed-length vector, also known as an \"embedding\", succinctly represents the most important features of the image based on the encoding performed by the CNN. This vector representation is subsequently used in the process of generating descriptions (captions) for the image, where relevant information has been condensed into a structured and manageable format for the neural network. Choosing a fixed-length vector facilitates consistency and efficiency in processing information within the network. After the image has been processed through the CNN to encode features, the generation of final descriptions involves appending the RNN to the last hidden layer of the CNN. The term \"last layer\" in this context refers to the final or output layer of the CNN. In neural networks, layers are stacked, and the last layer typically produces the final representation or output. In image captioning, the information encoded by the CNN is transferred to the RNN at this stage to further refine and generate coherent textual descriptions. The choice of utilizing a Long Short-Term Memory (LSTM) network as the RNN is significant. LSTM is a type of recurrent neural network designed to capture and retain long-term dependencies in sequential data.