## 3 Methodology and Implementation
### Methods of Compilation of the Neural Network Module
#### 3.2.1 TensorFlow Serving  
TensorFlow Serving is a flexible system supporting machine learning models for use in production environments. The use of TensorFlow Serving facilitates the implementation of new algorithms and experiments while maintaining the same server architecture and APIs, it also provides immediate integration with TensorFlow models, but can be extended to support other model and data types. Figure 5 presents a general diagram of the process of preparing the SSN model to stand alone as a query/response server using Docker and TensorFlow Serving environment. In order for the SSN model to run on its own using a TensorFlow Serving container (server), all the user needs to do is copy the saved model to the container you created in Docker, and then activate that model in the container for use. In the case of a model created using the PyTorch environment, it is necessary to convert the model description from the PyTorch environment (*.pth--model file extension in PyTorch) to the TensorFlow environment (*.pb--model file extension in TensorFlow) before the model dockerisation process itself (copying the model to a container and activating it). To convert an SSN model file saved with PyTorch, the first step is to convert the SSN model to a model definition in the ONNX (Open Neural Network Exchange) environment, which is a universal environment for defining SSN models and converting these models between different SSN learning environments. After converting the model to the ONNX environment, the resulting model can be converted to a model definition in TensorFlow. A general diagram of the model conversion from PyTorch to TensorFlow is shown in Figures 6 and 7 is a detailed diagram of the SSN model dockerisation process (after conversion from PyTorch to TensorFlow model). To create an SSN model server using Docker, the first step is downloading the TensorFlow Serving server image (pull TensorFlow/Serving), and then using the image to create a server container that will listen for queries for the stored SSN models. Once the container is created, an appropriate directory tree (layout) must be created in the container for the SSN models to be included. The catalogue arrangement should include the model name and version. Once the directory tree is created, copy the SSN model file(s) into the appropriate directory. Once the model file is copied, the model must be activated to listen for queries, which completes the dockerisation process. Figure 5: A general diagram of how to create a stand-alone server to handle SSN model queries. Figure 6: A general diagram of converting a model from the PyTorch environment to the TensorFlow environment to prepare it for inclusion in a TensorFlow/Serving container. Figure 8 is a detailed diagram of the process of converting an SSN model created using the PyTorch library to a TensorFlow model. In order to carry out the conversion process, it is necessary to have stored weights (obtained in the learning process), a model definition in the form of a class described in Python, and to have knowledge of the size of the input dimensions of the SSN model. Figure 8: A detailed diagram of the process of converting a model created in the PyTorch environment to the TensorFlow environment (*.pb indicates a TensorFlow model file in binary format). Figure 7: Detailed TensorFlow Serving container configuration diagram. The preparation of the model for dockerisation, i.e., its conversion, was implemented using the Python language. At the very beginning, the definition of the SSN model in the form of a class must be included for the script to work correctly. Then, create an instance of the SSN model (based on the attached definition) and load the previously trained weights into it. The next step in the model preparation process is to convert the model instance from PyTorch to a model instance in ONNX. However, this requires the input dimensions of the SSN model to be specified.