METHOD FOR LEARNED IMAGE COMPRESSION AND RELATED AUTOENCODER

IT202400021274U1Active Publication Date: 2026-03-24SISVEL TECH +2
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
IT102024000021274
Authority / Receiving Office
IT · IT
Patent Type
Utility models
Current Assignee / Owner
Filing Date
2024-09-24
Publication Date
2026-03-24
Estimated Expiration
2034-09-24

Smart Images

  • Figure 00000055_0000
    Figure 00000055_0000
  • Figure 00000056_0000
    Figure 00000056_0000
  • Figure 00000057_0000
    Figure 00000057_0000
Patent Text Reader
Need to check novelty before this filing date? Find Prior Art

Description

Description of the Industrial Invention entitled: “METHOD FOR LEARNED IMAGE COMPRESSION AND RELATED AUTOENCODER” on behalf of SISVEL TECHNOLOGY SRL, of Italian nationality, with registered office in Via Sestriere 100, 10060 None (TO) 09772000015, on behalf of UNIVERSITY OF STUDI DI TORINO, of Italian nationality, with headquarters in Via Verdi 8, 10124 Turin (TO) 02099550010, and on behalf of INSTITUT MINES TELECOM, of nationality French, with registered office at 19, place Marguerite Perey, 91120 Palaiseau, France and electively domiciled, for the purposes of this assignment, at the offices of the Agents Mirco BIANCO (Registration No. 1639B), Filippo FERRONI (Registration No. 530BM), Marco CAMOLESE (Registration No. 882BM), Giancarlo REPOSIO (Registration No. 1168BM), Corrado BORSANO (Registration No. 446BM), Matteo BARONI (Registration No. 1064BM). Designated Inventors: - Alberto PRESTA; - Attilio FIANDROTTI; - Enzo TARTAGLIONE - Marco GRANGETTO No. filed. DESCRIPTION The present invention relates to a method for learned compression of images according to the preamble of claim 1. The present invention further relates to an autoencoder which implements the method for learned image compression. Learned Image Compression (LIC) is became the object of considerable interest since it reached a compression efficiency comparable to that of standardized codecs (see Ma, Siwei et al., ”Image and video compression with neural networks: A review”, IEEE Transactions on Circuits and Systems for Video Technology, 2019, reference [1]). -1- On the transmitter side, the image is first projected into a latent representation with lower dimensionality via an encoder convolutional. Subsequently the latent representation is quantized and subjected to entropy encoding, producing a compressed representation of the image in the form of a binary bitstream. On the receiver side, this representation is inverted and re-projected into the pixel domain by a decoder, obtaining a lossy representation of the image original. Such encoder-decoder (autoencoder) models are trained end-to-end by backpropagating the error gradient to minimize a rate-distortion (RD) cost function in the form of ℒ = 𝑅 + 𝜆 ∙ 𝐷 (1) where 𝜆 is a hyperparameter that regulates the trade-off between rate 𝑅 of the latent representation and distortion 𝐷 of the reconstructed image. For example, a high value of 𝜆 places greater importance on the reconstruction quality at the expense of the latent space rate. The quantization of the latent representation is a crucial aspect: since quantization is a non-differentiable function, it cannot be easily incorporated into the backpropagation of the error gradient. A commonly used approach in LIC involves replacing the quantization with additive uniform noise, thus ensuring resilience to quantization errors. Most of the current approaches to learned compression of images all share the same drawbacks, namely that it is necessary train a separate encoder-decoder model with millions of parameters for each different bit-rate, with two important implications. First place, training a different model from scratch for each rate requires high costs in terms of time and energy. Second, the need to memorize a different model for each rate represents a significant problem, especially for devices with limited resources. These issues put the feasibility of compression at risk -2- learning of images in real-world scenarios, where rate control plays a key role a fundamental importance. Although some solutions have been recently proposed, the problem of variable bit-rate (VBR) image compression is still far from being resolved. Learned Image Compression Fundamentals Learned Image Compression models have been shown to be able to match or even surpass standardized codecs such as the recent H.266 / VVC (see Bross B. et al., “Versatile video coding”, JVET, 2020, reference [2]) in terms of RD performance. In foundational studies such as Ballé J., Laparra V. and Simoncelli E., ”End-to-end optimized image compression”, Proceedings of the International Conference on Learning Representations (ICLR), 2017, (reference [4]), e Theis L., Shi W., Cunningham A., and Huszár F., ”Lossy image compression with compressive autoencoders”, International Conference on Learning Representations (ICLR), 2017, (reference [5]) a simple structure has been used of a convolutional autoencoder with a unique latent representation modeled with a fully factorized distribution between modeled channels analytically (see Presta A. et al., “A differential entropy model for learned image compression”, International Conference on Learning Representations (ICLR), 2017, reference [6]) or through an auxiliary neural network, using GDN (Generalized Divisive Normalization) activation functions (see Ballé J., Laparra V. and Simoncelli. EP, ”Density modeling of images using a generalized normalization transformation”, International Conference on Learning Representations (ICLR), 2016, reference [7]). This scheme was improved by introducing a pyramid architecture composed of two nested variational autoencoders (see Ballé J., Minnen D., Singh S., Hwang SJ, and Johnston N., ”Variational image compression with a scale hyperprior”, Intl. Conf. on Learning Representations (ICLR), 2018, reference [8]). In this case, the first one is called hyperprior and captures the spatial correlation within the image, while the second models the latent representation, -3- which is assumed to follow a zero-mean Gaussian distribution. Minnen D., Ballé J. and Toderici, G.D., ”Joint autoregressive and hierarchical priors for learned image compression”, Advances in neural information processing systems, 2018, reference [9], Lee J. et al., ”Context-Adaptive Entropy Model for End-to-end optimized Image Compression”, Intl. Conf. on Learning Representations (ICLR), 2019, reference

[10] , and Minnen D. and Saurabh S, ”Channel-wise autoregressive entropy models for learned image compression”, IEEE International Conference on Image Processing (ICIP), 2020, reference

[11] , they combined a previous architecture with an entropy model context-based autoregressive to capture greater spatial correlation local by exploiting already decoded parts of images. Similarly, Li M. et al., ”Efficient and effective context-based convolutional entropy modeling for image compression”, IEEE Transactions on Image Processing, 29, 2020, pp. 5900-5911, reference

[12] , have improved the context modeling through a zigzag scanning order three-dimensional, and have improved the entropic decoding of parallelism with a 3D code division technique by partitioning the latent representation into a multiplicity of independent groups. In Li, Mu et al., ”Learning context-based nonlocal entropy modeling for image compression”, IEEE Transactions on Neural Networks and Learning Systems, 2021, [reference 13], a special non-local operation is proposed to consider global similarity within the context, introducing blocks similar to those of a U-net, while T. Chen et al., ”End-to-End Learnt Image Compression via Non- Local Attention Optimization and Improved Context Modeling”, IEEE Transactions on Image Processing, 2021, [reference 14], introduced non-local network operations such as non-linear transforms in both latent representations. In some more recent works other techniques have been used to improve the RD performance. Cheng Z. et al., ”Learned image compression with discretized Gaussian mixture likelihoods and attention modules”, Conference on Computer Vision and -4- Pattern Recognition, 2020, [reference 15], have replaced a simple Gaussian distribution with a mixture of Gaussians and introduced modules of attention to improve entropy estimation, while Fu H. et al., ”Learned Image Compression with Gaussian-Laplacian-Logistic Mixture Model and Concatenated Residual Modules”, IEEE Transactions on Image Processing, 2023, [reference 16], introduced a mixed Gaussian-Laplacian model. more flexible discretized logistic for latent representation. In Zou, Renjie, Chunfeng Song, and Zhaoxiang Zhang, ”The devil is in the details: Window-based attention for image compression”, Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, 2022, [reference 17], local attention is exploited by combining local conscious attention with global feature learning, and this is one of the architectures today that offer the best performance. Z. Tang H. et al., ”Joint Graph Attention and Asymmetric Convolutional Neural Network for Deep Image Compression,” IEEE Transactions on Circuits and Systems for Video Technology, 2023, [reference 18], proposed a graph-based self-attention mechanism for improving entropy estimation, while other lines of study have tried to refine some aspects of models previous ones. In Xie Y., Cheng KL, and Chen Q., ”Enhanced invertible encoding for learned image compression”, Proceedings of the 29th ACM international conference on multimedia, 2021, [reference 19], for example, a better one has been extracted transformation between image and latent feature space using networks invertible, while in Jacobsen J.-H., Smeulders A. and Oyallon E., ”i-revnet: Deep invertible networks”, International Conference on Learning Representations (ICLR), 2018, [reference 20], and Zhu Y. et al., ”Transformer-based transform coding”, International Conference on Learning Representations (ICLR), 2022, [reference 21], the convolutional modules have been replaced with the transformer Swin to achieve higher compression efficiency with fewer parameters. Y. Wu et al., ”Learned Block-Based Hybrid Image Compression,” IEEE Transactions on Circuits and Systems for Video Technology, 2022, [reference 22], -5- Instead, they focused on optimizing image decoding using a learned block structure. In Wang D. et al., ”Neural data- dependent transform for learned image compression”, Proceedings of the IEEE / CVF Conference on Computer Vision and Pattern Recognition, 2022, [reference 23], an attempt was made to fit the entire structure to single images with an additional model flow to generate the transformation parameters at the decoder, and in He, Dailan et al., ”Checkerboard context model for efficient learned image compression”, Proceedings of the IEEE / CVF Conference on Computer Vision and Pattern Recognition, 2021, [reference 24], introduced a checkerboard context model to improve efficiency during the decoding. In Duan Z. et al., ”Lossy Image Compression with Quantized Hierarchical VAEs”, Proceedings of the IEEE / CVF Winter Conference on Applications of Computer Vision, 2023, [reference 25], exploits the VAE (Variational AutoEncoder) hierarchical, originally conceived for modeling generative imaging, for lossy image compression, redefining them the probabilistic model to allow easy quantization and functional entropy coding. In addition to those mentioned above, based on variational autoencoder, there have been other approaches to image compression using networks have also been explored neural. Agustsson, E., et al., ”Generative adversarial networks for extreme learning image compression”, Proceedings of the IEEE / CVF International Conference on Computer Vision (ICCV), 2019, [reference 26], and Mentzer, F. et al., ”High-fidelity generative image compression”, Advances in Neural Information Processing Systems 33, 2020, [reference 27], employed a network-based architecture GAN to reduce image compression artifacts, especially at very low bit rates. The common feature of all the above studies is that a single model aims at a single rate, which means that training and memorization are necessary a variety of models to cover the variety of rates required in real scenarios image or video compression. This is a significant issue, as -6- Each model includes tens of millions of learnable parameters. In variable rate image compression, this aspect can also be related to the way quantization is performed, as will be discussed in the followed. Quantized latent representations for end-to-end learning In end-to-end image compression, space quantization latent is critical because of its non-differentiability: the gradient of the quantization function is zero everywhere except at the boundaries between the levels of quantization, where it is undefined. Below we will analyze the most common approaches common to this problem, which are based on the replacement of the quantization with an approximate function. 1) Straight-through estimator: used in reference [5], this method involves replacing the derivative of the quantization with a uniform approximation during the backpropagation phase, maintaining the original function during the forward propagation phase. In particular, this method uses the linear function as a derivative, being easy implementation as it does not make any changes to the gradient. This method lacks elasticity as it does not allow for gradual relaxation during training, imposing quantization on integers even during the training. 2) Additive uniform noise: introduced in reference [4], provides for the replacement of the actual quantizer with additive uniform noise during training. The advantage of this method is that the density function associated with the noisy latent space represents a continuous relaxation of the discrete density mass found in quantized space. Furthermore, the noise independent uniform is commonly used as a representation of the quantization error due to its ability to approximate the marginal moments of error (see Gray, Robert M. and David L. Neuhoff, ”Quantization”, IEEE transactions on information theory, 1998, [reference 28]). In addition to these two aspects, adding uniform noise allows you to redefine -7- training as a variational optimization problem, see reference [4], resulting in more effective learning of the flexible latent space. All these benefits have made this method one of the procedures most used to approximate quantization during training, see references [4], [8], [9],

[15] , making it a standard in fact. However, this method has one significant drawback: it allows quantization only on integers, without the possibility of adapting the quantization intervals. This is because it is not possible in any way control the latent space, since the latter is not parameterized, which forces you to train a different model for each RD tradeoff. 3) Soft-to-hard annealing: These methods are based on annealing (annealing) of a parameter, called temperature, to approximate the quantization. The basic concept is to reduce this hyperparameter during training to gradually constrain the latent representation, proceeding towards a hard quantization form to finally freeze it. For example, using the softmax function on a partition of the space latent in Voronoi tessellation on centers enables a soft quantization, as described in Agustsson E. et al., ”Soft-to-hard vector quantization for end-to-end learning compressible representations”, Advances in neural information processing systems, 2017, [reference 29], and in Guo, Zongyu et al., ”Soft then hard: Rethinking the quantization in neural image compression”, International Conference on Machine Learning, PMLR, 2021, [reference 30]. In Agustsson E. and Theis L., ”Universally quantized neural compression”, Advances in neural information processing systems, 2020, Vol. 33, [reference 31], adaptive uniform noise and a new quantization variant are combined softmax to bridge the gap between quantized and continuous latent space, obtaining robustness to quantization errors. Despite its effectiveness, this The method suffers from some limitations: first of all, it is not agnostic to the estimation of entropy, as it is not able to handle the Gaussian distribution as -8- prior; secondly, it introduces an additional term in the function of loss; thirdly, it is not focused on adapting to the variable rate. The approach described in Shlezinger, Nir and Eldar, Yomina C, “Deep task-based quantization”, Entropy, 2021, reference

[32] , concerns communications of the type Multiple-Input Multiple-Output (MIMO) and is based on a finite summation of hyperbolic tangents to overcome the non-differentiability of the phase quantization. Although this question shares the same structure conceptual, it nevertheless addresses the specific and different challenges of the image compression. Furthermore, reference

[32] provides for the annealing of a specific temperature for each hyperbolic tangent, requiring adjustment of a number of parameters equal to the number of quantization stages. Towards variable rate image compression Almost all of the quantization approaches described above involve the same disadvantage, namely that you need to train a different model of encoder-decoder for each rate. Some proposals have been made in credit to the learned compression of variable rate images, some of which will be described below. In reference [5], the latent representation of a single autoencoder It is scaled before quantization by adding a scale parameter learnable for each channel; this allows the adaptation of the latent space in based on the requested bitrate. However, using a single value for each channel to adapt the quality level may lead to a reduction in RD performance. Choi, Y., Mostafa E., and Jungwon L., ”Variable rate deep image compression with a conditional autoencoder”, Proceedings of the IEEE / CVF International Conference on Computer Vision (ICCV), 2019, [reference 33], proposed an autoencoder that is conditioned on the Lagrangian multiplier λ, the which is not treated in the usual way, i.e. as a normal hyperparameter, but It is instead used as an input to the network to produce specific latent representations. In addition, the network was trained using mixed sizes of quantization bins, allowing it to adapt the rate by adjusting the bin size of the quantization applied to the -9- latent representation. This model increases the complexity of the optimization since it introduces λ and the size of the bins as inputs for determine the desired bitrates. Another approach involves deploying a model that considers different resolutions simultaneously in the same training phase, making it adaptable to different RD compromises. Yang F. et al., ”Variable rate deep image compression with modulated autoencoder”, IEEE Signal Processing Letters, 2020, [reference 34], have presented an optimization problem of a variable RD, in which the structure A modulated framework is added to deep image compression. This framework allows the structure to adapt to various compression levels. In C. Cai, L. Chen, X. Zhang and Z. Gao, ”Efficient Variable Rate Image Compression With Multi-Scale Decomposition Network”, IEEE Transactions on Circuits and Systems for Video Technology, 2019, reference

[35] , The autoencoder is trained to split the input image into multiple levels of representations, aiming to optimize rate-distortion performance on all scales. However, reference

[34] and reference

[35] both make it more the training phase is complicated and unstable. In Cui, Ze et al., ”Asymmetric gained deep image compression with continuous rate adaptation”, Proceedings of the IEEE / CVF Conference on Computer Vision and Pattern Recognition, 2021, reference

[36] , a pair of parametric gain units before and after the quantization stage to obtain a discrete rate fit with a single model; by exponential interpolation results in a continuous adaptation of the rate without compromise performance. In particular, for each target level there is a specific pair of gain units that multiply the latent representation element by element before and after quantization. However, in addition to the units of gain, the reference

[36] modifies the entropic model, passing from a symmetric Gaussian distribution to an asymmetric Gaussian distribution, which makes it more complex to evaluate the benefits of the earning units in -10- insulation. Taking a different approach, Jooyoung L., Seyoon J., and Munchurl K., ”Selective compression learning of latent representations for variable-rate image compression”, Thirty-Sixth Conference on Neural Information Processing Systems, 2022, reference

[37] , introduced a 3D importance map for obtain essential representations for compression at various quality levels, in thus encoding only a partial version of the latent representation based on the desired quality level. In addition, quantization was used with quality adaptation by multiplying the latent representation by a quantization vector, similar to reference

[36] . Despite its effectiveness, reference

[37] requires learning the importance map, which involves training thousands of parameters. Similar to reference

[36] , in Chen, Tong, and Zhan Ma, ”Variable bitrate image compression with quality scaling factors”, International Conference on Acoustics, Speech and Signal Processing (ICASSP), IEEE, 2020, reference

[38] , a set of quality scaling factors (SF) is incorporated into a model by which It is possible to encode images over an entire bit-rate range with a single model; this approach however shares the same limitations as the reference

[36] . In Gao, Chenjian, et al. ”Flexible neural image compression via code editing”, Advances in Neural Information Processing Systems, 35, 2022, reference

[39] , yes obtains an optimal “per image” representation by applying the SGD to the latent space and determining the quantization phase using a search grid. This approach is limited by the need to perform optimization during the encoding of each single image, making it impractical in the most cases where there are constraints in terms of computational costs or of real-time capacity. In Guo-Hua Wang, Li Jiahao, Li Bin, and Lu Yan, ”EVC: Towards Real-Time Neural Image Compression with Mask Decay”, Eleventh International Conference on Learning Representations, 2023, reference

[40] , exploiting the decay of mask parameters, adjustable quantization phase and distillation of the -11- knowledge to train a smaller model using a model teacher; variable bitrate is achieved using quantization steps adjustable. A large model is thinned out using layers of decay of learnable masks. This method, however, is based on a phase of multi-stage training which is very complex and is not agnostic to to architecture, compromising the possibility of adding this technique in a generic image compression model. In general, the problem of fitting a single model to different rates has been so far the subject of little attention, as efforts have been concentrated on the improved compression performance. However, the ability to Switching efficiently between different rates is a key requirement for to achieve workable image encoding. The present invention intends to solve these and other problems by indicating a method for learned image compression and a related autoencoder able to reduce the overall training complexity during training a model at different bit rates. It is a further object of the present invention to indicate a learned image compression method and a related autoencoder that allow the same model to be adapted to different bit rates. It is a further object of the present invention to indicate a learned image compression method and a related autoencoder that are suitable for use with any learnable image compression scheme. It is a further object of the present invention to indicate a learned image compression method and a related autoencoder in able to save energy and processing time during training a model with different bit rates. It is a further object of the present invention to indicate a learned image compression method and a related autoencoder applicable to resource-constrained devices used in real-world scenarios. It is a further object of the present invention to indicate a learned image compression method and a related autoencoder that -12- are agnostic to the prior. It is a further object of the present invention to indicate a learned image compression method and a related autoencoder that can be easily inserted into different types of models. It is a further object of the present invention to indicate a learned image compression method and a related autoencoder that do not add additional terms in the loss function to minimize the quantization error. In short, to build a variable rate model, the present invention exploits an activation function called STanH, which is a layer of differentiable quantization that can be inserted into a codec pre-trained to achieve variable bitrates. The STanH activation function is designed as a function of a summation finite hyperbolic tangents that relaxes the quantization function during the training. Relaxation is controlled by a single temperature that is subjected annealing during training to get closer to the quantization levels desired. The STanH activation function can be implemented as a layer of differentiable quantization with only a few hundred parameters learnable, allowing standard training via backpropagation of the end-to-end error. Compared to comparable methods, the STanH activation function manipulates directly the latent representation, determining only the levels of Quantization. This allows you to switch from fine to coarse quantization. simply by refining the parameters of the quantization layer, without having to retrain the other parameters of the model. The method according to the present invention allows to vary the rate of encoding by simply changing the quantization layer, thus decreasing the memory needed to store the models, avoiding long waiting times training and reduce energy needs. -13- The method according to the present invention has been tested with three different state-of-the-art image compression architectures, and has been verified that it allows variable rate encoding with negligible impact on coding efficiency. To the best of the Applicants' knowledge, this application is the first to show that a trained LIC model can be transformed into a variable rate simply by inserting a quantization layer learnable. The method according to the present invention requires only the adjustment of a single value to control the annealing of a specific temperature. According to a first embodiment of the method according to the invention, A method for learned image compression implemented in a autoencoder comprising an image reconstruction encoder and an image reconstruction decoder, said method comprising the steps of: a) extract a principal latent representation from an image by means of image reconstruction encoder; b) quantize the latent representation of the image by means of a quantizer to obtain a discrete principal latent representation; c) entropically encode the discrete main latent representation for using an entropy encoder to obtain a bitstream; d) entropically decode the bitstream by means of a decoder entropic to obtain an entropically decoded bitstream; e) feed the entropically decoded bitstream to the decoder image reconstruction; f) recover a reconstructed image by means of the decoder image reconstruction; g) train the autoencoder using standard gradient descent backpropagated error gradient minimizing a rate-cost function L distortion by relaxing the discrete principal latent representation by means of of a soft quantized principal latent representation, -14- where the quantizer is implemented in the form of an activation function parameterized where L is a number of quantization levels sought, β is a parameter of inverse temperature that regulates a slope of the quantization levels, eweb are parameters that determine the levels of reconstruction and the width of the quantization intervals of the latent representation soft quantized main. According to one aspect of the method according to the invention, the parameter w for determine the reconstruction levels and the parameter b to determine the amplitude quantization intervals are learned to minimize the function cost rate-distortion L. According to a further aspect of the method according to the present invention, the rate-distortion cost function L is in the form ℒ = R + λ ∙ D, where λ is a hyperparameter that regulates the trade-off between the bit-rate R of the representation main latent and D distortion of the reconstructed image. According to a further aspect of the method according to the present invention, the inverse temperature parameter β gradually increased during training with an annealing procedure. According to a further aspect of the method according to the present invention, the annealing procedure is based on a function that considers both the number of training iterations is the difference between the latent representation soft quantized principal and discrete principal representation. According to a further aspect of the method according to the present invention, the inverse temperature parameter β is calculated as: where t is the t-th training phase, where e -15- are respectively the quantization errors of the latent representation soft quantized principal and discrete quantized latent representation, where is the error between the quantization errors at the phase of training t, where β represents the value used at the t-th stage, and where t K is a factor that regulates the speed at which the representation is frozen soft quantized principal latent. According to a second embodiment of the method according to the present invention, a method for learned image compression is described implemented in an autoencoder comprising a image reconstruction and an image reconstruction decoder, the method including the steps of: a) extract a principal latent representation from an image by means of image reconstruction encoder and a latent representation hyperprior by means of a hyperprior analysis transformation block; b) quantize the main latent representation by means of a first quantizer to obtain a discrete principal latent representation and the latent hyperprior representation by means of a second quantizer for obtain a discrete hyperprior latent representation; c) entropically encode the discrete main latent representation for means of a first entropy encoder to obtain a first bitstream and the discrete hyperprior latent representation by means of a second encoder entropic to get a second bitstream; d) entropically decode the first bitstream by means of a first entropy decoder to obtain a first decoded bitstream entropically and the second bitstream by means of a second decoder entropic to obtain a second entropically decoded bitstream; e) feed the first and second entropically decoded bitstreams to the image reconstruction decoder; f) recover a reconstructed image by means of the decoder image reconstruction; g) train the autoencoder using standard gradient descent -16- backpropagated error gradient minimizing a rate-cost function L distortion by relaxing the discrete principal latent representation by means of of a soft quantized principal latent representation and a representation discrete hyperprior latent representation by means of a hyperprior latent representation soft quantized, where the quantizers are implemented in the form of respective parameterized activation functions where where t indicates the t-th training phase, L is a number of training levels quantization sought, β is an inverse temperature parameter that governs a slope of the quantization levels, web are parameters that determine the reconstruction levels and the width of the intervals respectively quantization of the soft quantized principal latent representations, and the subscripts {h,m} indicate the two different latent representations, namely respectively the hyperprior one and the principal one. According to a further aspect of the method according to the present invention, the rate-distortion cost function L is where d is a distortion metric, λ is a hyperparameter that governs the trade-off between bit-rate R of the main latent representation and distortion D of the reconstructed image, represents a rate of the latent hyperprior representation, and represents a rate of the main latent representation from which the image is reconstructed. According to a further aspect of the method according to the present invention, the inverse temperature parameters β and β are gradually increased during h,tm,t training with an annealing procedure. According to a further aspect of the method according to the present invention, the annealing procedure is based on a function that considers both the number of training iterations is a difference between the latent representation -17- soft quantized principal and the discrete principal representation and a difference between the soft quantized hyperprior latent representation and the discrete hyperprior latent representation. According to a further aspect of the method according to the present invention, the inverse temperature parameter βm,t is calculated as: where t is the t-th training phase, where e are respectively the quantization errors of the latent representation principal quantized soft representation ̃ (𝐲 ) and the quantized latent representation discrete ̂ () 𝐲 , where is the error between the quantization errors at the phase of training t, and where K is a factor that regulates the speed with which it is frozen self-quantized latent representation; and the inverse temperature parameter β is calculated as: h,t 2 2 where t is the t-th training phase, where e ̃ = ‖z ̃ − z‖ and e ̂ = ‖z ̂ − z‖ are tt respectively the quantization errors of the latent representation a soft quantized hyperprior (z ̃) and the quantized hyperprior representation discrete ̂ (𝐳 ), E = ⌈e ̂ − e ̃ ⌉ is the error between the quantization errors at the phase of ttt training t, and where K is a factor that regulates the speed with which it is frozen the soft quantized hyperprior latent representation (z ̃). According to a further embodiment of the present invention, there is Learned image compression autoencoder released including: - an image reconstruction encoder configured to extract from an image is a principal latent representation; - a quantizer configured to quantize the latent representation -18- principal to obtain a discrete principal latent representation; - an entropy encoder configured to entropically encode the discrete principal latent representation to obtain a bitstream; - an entropy decoder configured to entropically decode the bitstream to get an entropically decoded bitstream; - an image reconstruction decoder configured to receive the entropically decoded bitstream; - an image reconstruction decoder configured to recover a reconstructed image; - means for training the autoencoder using standard gradient descent of the back-propagated error gradient by minimizing a rate-cost function L distortion by relaxing the discrete principal latent representation by means of of a soft quantized principal latent representation, where said quantizer is implemented in the form of a function of parameterized activation where L is a number of quantization levels sought, β is a parameter of inverse temperature that regulates a slope of the quantization levels, ewe b are parameters that determine the reconstruction levels and respectively the width of the quantization intervals of the latent representation soft quantized main. According to a further embodiment of the present invention, describes an autoencoder for learned image compression including: - an image reconstruction encoder configured to extract from an image a main latent representation and a block of hyperprior analysis transformation configured to extract from said image a hyperprior latent representation; - a first quantizer configured to quantize the latent representation -19- principal to obtain a discrete principal latent representation and a second quantizer configured to quantize the latent representation to hyperprior to obtain a discrete hyperprior latent representation; - a first entropy encoder configured to entropically encode the discrete main latent representation to obtain a first bitstream and a second entropy encoder configured to entropically encode the discrete hyperprior latent representation to obtain a second bitstream; - a first entropy decoder configured to entropically decode the first bitstream and a second entropy decoder configured for entropically decode the second bitstream to get a second entropically decoded bitstream; - an image reconstruction decoder configured to receive the first and second entropically decoded bitstreams; - an image reconstruction decoder configured to recover a reconstructed image; - means for training the autoencoder using standard gradient descent of the back-propagated error gradient by minimizing a rate-cost function L distortion by relaxing the discrete principal latent representation by means of of a soft quantized principal latent representation and the representation discrete hyperprior latent representation by means of a hyperprior latent representation soft quantized, where the first and second quantizers are implemented under form of respective parameterized activation functions where t indicates the t-th training phase, L is a number of training levels quantization sought, β is an inverse temperature parameter that governs a slope of the quantization levels, web are parameters that determine the reconstruction levels and the width of the intervals respectively quantization of the soft quantized principal latent representations, and the subscripts -20- {h,m} indicate the two different latent representations, namely respectively the hyperprior one and the principal one. According to a further embodiment of the method according to the present invention, a method for variable rate image compression is described implemented in a device, the method comprising: - train one or more models from scratch by still selecting appropriate λ values for placement on a target rate-distortion (RD) curve; - generate one or more derivations from each of the still-trained models cloning the still-trained model and setting a smaller λ value for aim for a lower rate; - resume the training procedure for each derivation, in which they are only the quantization layers related to the activation function were refined parameterized according to the invention, and all other parameters of the derivation they are kept unchanged with respect to the reference model; - store only the refined quantization layers after the completion of the refinement process, in which all the layers of the derivation, except the layers of refined quantization, are identical to the still model; and - enable variable rate image compression in that device replacing a current quantization layer with that of a refined anchor to switch rates without the need to train a separate model for every rate. The invention will be described in detail below through some forms of non-limiting implementation of the same with reference to the attached Figures, in which: - Figure 1 schematically represents a reference architecture note for learned image compression comprising two layers of quantization according to the invention for quantizing a latent space principal and a hyperprior latent space; - Figure 1a schematically represents an entropy model block autoregressive channel by channel of Figure 1; - Figure 2 represents a graph of an activation function according to the invention; -21- - Figure 3 represents a table showing parameters used for define anchors for reference models according to the prior art, i.e. models in which all layers are trained end-to-end; - Figure 4 shows a table representing values ​​used for training derivations, i.e. models in which only the quantization layers according to the invention; - Figures 5(a)-5(f) represent graphs showing the rate-performance Distortion of the known reference architecture of Figure 1 on the Kodak dataset using a different number of anchors, from six to one; - Figure 6 shows a table representing the BD-Rate and BD-PSNR values compared to the known reference architecture in Figure 1 on the Kodak dataset for different anchor numbers, where savings are indicated in terms of parameters trainable; - Figures 7(a)-7(i) represent graphs showing the Rate-PSNR values for the method according to the present invention and the related reference according to the prior art for the Kodak, Clic and Tecnik datasets and for three anchors and three derivations; - Figures 8(a)-8(c) represent MS-SSIM plots for the method according to the present invention and the related reference according to the prior art for the dataset Kodak and for three anchors and three leads; - Figure 9 shows a table representing the BD-Rate and BD-PSNR values on the Kodak dataset for three anchors, where savings are shown in terms of trainable parameters; - Figure 10 shows a table representing the costs of the method according to the invention in terms of various parameters; - Figure 11 represents an RD plot for the model according to this invention and corresponding references according to the prior art for the Kodak dataset; - Figure 12 shows a table representing some parameters of the method according to the invention compared to the prior art on a reference H266 / VVC; - Figure 13 shows an RD plot for a model according to the invention for the Kodak dataset versus a prior art architecture; - Figure 14 shows a radar chart comparing the reference according to -22- the prior art and the method according to the invention in terms of various parameters; - Figure 15 shows a known reference architecture for compression image learning including a quantization layer according to the invention for quantizing a principal latent space. Figure 1 schematically represents an autoencoder 1 for learned image compression, i.e. an architecture based on the reference

[17] and using a convolutional neural network (CNN, Convolutional Neural Network), in which a first quantizer 2 and a second quantizer 3 according to the present invention. An image encoder f projects an image of reconstruction to input x to a low-dimensional principal latent representation y of dimension M, representing the number of channels, which is then quantized by the first quantizer 2, thus obtaining a principal latent representation discrete y ˆ: y is called the principal latent representation since the image is directly reconstructed from it. The main latent representation y is then further projected, by means of a hyperprior analysis transformation block, in a h to latent hyperprior representation of dimension , which is z = h (y) N to subsequently quantized by a second quantizer 3, producing a discrete hyperprior latent representation ˆ z. To enable the latent representation to be passed to hyperpriors discrete ˆ z from the encoding side to the decoding side of autoencoder 1, a first entropy encoder 7, in an arithmetic encoder, is configured to particular process the discrete hyperprior latent representation to produce ˆ z a first compressed latent space 8 in the form of a bitstream, which is then fed to a first entropy decoder 9, in particular a decoder arithmetic, to produce a first decompressed latent space corresponding to the discrete hyperprior latent representation ˆ z. The discrete hyperprior latent representation ˆ z is used to find the Spatial correlation for entropy model block estimation of entropy autoregressive channel by channel 10, see reference

[11] , where we introduced -23- channel conditioning and latent residual prediction for, respectively, improve rate approximation and reduce quantization error. To enable the transmission of the main latent representation discrete y ˆ from the encoding side to the decoding side of autoencoder 1, a second entropy encoder 4, in particular an arithmetic encoder, is configured to process the discrete principal latent representation for y ˆ produce a second compressed latent space 5 in the form of a bitstream, which is then fed to a second entropy decoder 6, in particular a arithmetic decoder, to produce a second decompressed latent space corresponding to the discrete principal latent representation. y ˆ Referring to Figure 1a, the main latent representation y is divided into slices 13,14 provided as input to block 10, and each slice is encoded in sequence using the previously encoded ones. The channel-by-channel autoregressive entropy model block 10 includes 15,16 slice encoders. In addition, the slice encoder blocks 15,16 use the output of the hyperprior encoder / decoder 17. The residual vectors r are the outputs of 18 blocks named LRP and LRP , where 1 2 LRP stands for Layer-wise Relevance Propagation. layer by layer). For this purpose, the discrete principal latent representation y ˆ, or map of characteristics, is divided into a predetermined number of slices, after which the spatial context of a specific slice is extracted by integrating, through a adder block 12 (see Figure 1), information coming from both the hyperprior and from a channel context model that receives previously entered slices decoded. In addition, a residual vector r obtained during the phase of quantization, which is then added to the latent representation, always through the adder block 12, to reduce the quantization error. Referring again to Figure 1, a model block output 11 entropic autoregressive channel by channel 10 is represented in terms of mean µ and standard deviation σ, which represent the spatial correlation for each -24- element of the discrete principal latent representation y ˆ, given that the latter is modeled as a Gaussian distribution. The standard deviation σ of output 11 is provided to both the second encoder arithmetic 4 is to the second arithmetic decoder 6, while the mean µ of output 11 is used to translate the main latent representation discrete y ˆ such that it has zero mean when compressed. Finally, the discrete main latent representation is fed to a y ˆ image reconstruction decoder f (synthesis transform), obtaining s in this way a reconstructed image x ˆ = g (y ˆ). s According to the invention, the first quantizer 2 and the second quantizer 3 are implemented in the form of a new activation function parameterized called STanH. The first quantizer 2 and the second quantizer 3 are implemented for quantize respectively the main latent representation y, or space principal latent, and the hyperprior latent representation z, or latent space a hyperprior. Sum of hyperbolic tangents by differential quantization It is recalled that the present invention aims to define a function of scalar quantization that is differentiable and allows backpropagation of the gradient of the error function during training when it is inserted into an autoencoder 1 like the one in Figure 1. 𝑥𝐶𝐻𝑥𝑊 ∈ ℝ Let 𝒚 denote a tensor representing a latent space with a real value, where C, H and W represent the channels, height and the width. In this context, the goal is exemplified as the relaxation of the discrete principal latent representation y ˆ via a representation principal latent quantized soft proxy continues y ˜ during training. To achieve this goal, the desired quantization function must meet the following requirements: i) the slope of the quantization steps must be controllable during the training; -25- ii) the width of the quantization interval and the corresponding level of reconstruction must be parametric and learnable during training. Requirement i) is instrumental in making the quantizer arbitrarily close to a true scalar quantizer, that is, to a ladder function. Requirement ii) allows the model according to the present invention to adapt advantageously the quantization intervals during training, in such a way way by replacing the conventional technique of rounding to integers. This aspect is fundamental to the method according to the present invention since it allows the same model to be adapted to different rates, as will be demonstrated experimentally in the following. To satisfy these two requirements, an activation function is used. parameterized STanH according to the invention, illustrated in Figure 2. In particular, Figure 2 represents a 30 graph of the function of the invention STanH activation according to with L = 5 quantization levels and for increasing values ​​of inverse temperature β. particular More in: - curve 20 represents the STanH activation function with β = 1; - curve 21 represents the STanH activation function with β = 2; - curve 22 represents the STanH activation function with β = 5; - curve 23 represents the STanH activation function with β = 10; - curve 24 represents the STanH activation function with β = 20; - curve 25 represents the STanH activation function with β → +∞. Indicating with L the number of desired quantization levels, the function of quantization STanH is then defined as the sum of L - 1 tangents hyperbolic translated and weighted and is applied element by element to the main latent representation y as follows: regard As regards requirement i), that is to say the fact that the slope of the -26- quantization phases must be controllable during training, β, which is defined as inverse temperature, regulates the slope of the phases of quantization, i.e. the relaxation of the main latent representation discrete y ˆ: the greater β, the closer the slope is to that of the ladder function. For this reason, the value of β is gradually increased during training with an annealing procedure that will be described in detail below. As regards requirement ii), namely the fact that the breadth of the quantization interval and the corresponding reconstruction level must be parametric and learnable during training, the parameters ( ) ( ) 𝒘 = 𝑤 , 𝑤 , … , 𝑤 and 𝒃 = 𝑏 , 𝑏 , . . . , 𝑏 determine the levels respectively 1 2 𝐿−1 1 2 𝐿−1 of reconstruction for the soft quantized principal latent representation y ˜ e the width of the quantization intervals. assuming In fact, 𝛽 = ∞ in formula (2), the first level of reconstruction will be equal to where the subscript y < b represents the application of STanH to a generic value less than b . The i-th reconstruction level l is then obtained by adding 𝑤 to the the 𝑖−1 previous level l as follows: i-1 Consequently, during the inference time, with β →+∞, the formula (2) is replaced by the real scalar quantizer with the reconstruction levels of the formula (4) and the quantization intervals determined by the parameter 𝒃 , thus obtaining the soft quantized principal latent representation y ˜. During training, with β < +∞, the transitions between the levels of reconstruction are leveled exponentially as in Figure 2, which exemplifies STanH with L = 5: for β = 1, the shape of STanH is close to the tangent hyperbolic; as β increases, the shape progressively approaches the function -27- of scalar quantization. Since STanH has a derivative in its entire domain, the parameters 𝒘 and 𝒃 can be learned to minimize the rate-distortion cost function when the STanH quantization function is inserted into the procedure backpropagation, as will be described below. Temperature annealing procedure It will now be explained how the annealing of the For inverse temperature β to obtain a final configuration consistent with the (non-differentiable) function that performs quantization directly at the levels of quantization. To achieve this goal, the temperature annealing procedure covers inverse β is of crucial importance to achieve the necessary convergence: too rapid annealing could cause the model to settle on a local minimum, while too slow annealing could lead to poor robustness to quantization errors. Following Sohl-Dickstein J. et al., ”Deep unsupervised learning using nonequilibrium thermodynamics”, International Conference on Machine Learning, 2015, reference

[41] , the problem was addressed by increasing in incremental manner β, relying on a function that considers both the number of training iterations is the difference between the latent space relaxed y ˜ and the quantized latent space y ˆ. In this way, during training is possible to progressively approach the latent configuration discrete or quantized. Drawing inspiration from reference

[29] , we propose a strategy where β is increased semi-deterministically. In short, the possible values ​​of the latent representation are progressively driven towards discrete quantization levels, without however overly constrain the configuration of the latter during the training. with Let t denote the t-th phase of the training procedure based on the backpropagation of the error gradient described below. -28- For a given batch of training samples, the quantization errors of the soft quantized principal latent representation y ˜ and of the discrete quantized latent representation y ˆ are calculated as: Considering the absolute difference between formula (5) and formula (6), it is obtains the error between the discrete and continuous representation at the phase of training t: The smaller the error, the closer the latent space y ˜ is to the real one. discrete space to encode y ˆ. After calculating E , the temperature values t are updated: where β represents the value used at the t-th stage, and K is a factor that governs t the speed with which the latent representation is frozen. comprehend It can be easily seen as, as the stages of training, the latent representation becomes on average increasingly larger frozen towards the real final configuration, making the model robust to the quantization error. End-to-end learning with STanH It will now be illustrated how the differentiable quantizer according to the invention is implemented in the form of a layer that can be inserted into a generic image compression model. Subsequently, the rate-distortion cost function will be formulated by the training minimize during and the procedure will be described in detail end-to-end training. Although the training procedure has been exemplified here for -29- autoencoder 1 in Figure 1, it can be generalized to any autoencoder architecture. The STanH activation function can be implemented as a layer parametric to perform quantization that can be inserted into any arbitrary position within a neural model capable of performing the learned image compression. In the case of architecture 1 of Figure 1, the latent representation a hyperprior z and the principal latent representation y must both be quantized, so two independent instances of the STanH layer are needed. instance Each work is independent and is subjected to a separate training to acquire its own distinct functions of quantization. In fact, zey have different semantic meanings: the first represents the latent hyperprior representation, while the second represents the main latent representation from which the image is reconstructed. It is therefore It is likely that the latent representations z and y have distinct distributions with distinct optimal quantization levels. Having two separate STanH layers advantageously, it ensures that the additional parameters to be trained are only a few hundred, which is a negligible number compared to the training of the entire model. When you enter STanH, you get the following latent representations: And where t indicates the t-th training phase, while the subscripts {h,m} indicate the two different latent representations, namely the hyperprior one respectively -30- and the main one. It should be noted that, since STanH and STanH are implemented as two hm independent layers, β and β are also modified by annealing h,tm,t independently of each other. By inserting the STanH layer into an image compression model, retains the nature of the normal rate-distortion (RD) optimization problem where the first term is some distortion metric d, the second term represents the rate of the hyperprior latent space, calculated by means of a small neural network trained to calculate said rate, and the third term represents the rate of the main latent space from which it is reconstructed the image, calculated using a Gaussian mass probability function where y is distributed as a Gaussian latent space. The hyperparameter λ is the Lagrangian multiplier that controls the trade-off between rate and distortion. A high value of λ imposes a greater penalty on large distortions, while a low value of λ places a greater penalty on the rate of the latent representations z and y. In particular, for the second term the proposed standard approach is followed in reference [8], i.e. using an ad-hoc neural network to estimate directly the rate: in this way, using the same configuration adopted in works of prior art, a fully factorized distribution is required between the channels as follows: where 𝜓 represents the learnable parameters. O The third term represents the rate of a Gaussian-like latent space, so it is not necessary to use an additional neural network to determine the rate. In fact, for a specific y, it is possible to evaluate its distribution the -31- cumulative during training as: where Φ is the cumulative distribution function of the Gaussian distribution − + with mean µ and standard deviation σ, while 𝑟 and 𝑟 are respectively the limits ii 𝑖 𝑖 left and right quantization intervals associated with 𝑦̃. 𝑖 Note that, unlike the prior art which relies on a quantization − + uniform on integers, where 𝑟 and 𝑟 are both equal to 0.5, in the method according to 𝑖 𝑖 the present invention these two values ​​change depending on the function of STanH activation. 3) Learning procedure: remember that one of the objectives of the The present invention is to achieve variable rate image coding without having to train a separate model for each target rate as in the references

[15] ,

[17] and

[19] . at least Suppose that a model, called the anchor model, has been preliminarily trained for a given target rate. Since in the method according to the present invention the quantizer is implemented as a learnable layer, different results can be achieved rate-distortion tradeoffs by inserting a different STanH layer into the anchor and refining the STanH parameters for different values ​​of λ. the STanH In practice, layer is inserted into the anchor and all the layers still are frozen except STanH, and this last layer is refined for some eras. The procedure is repeated for each different target rate, refining one separate STanH layer for a different value of λ for each target rate. More in detail, the STanH layer is refined for increasingly smaller values ​​of λ in the formula

[11] (i.e. the target rate is gradually reduced). -32- The result of this procedure is a set of refined models that share same the learnable parameters of the anchor except the STanH layer: These models are called derivations. At the end of the refinement process it will therefore be necessary to memorize only one anchor model and one STanH layer for each derivation. Once Once the refinement procedure described above has been completed, it will be possible to switch the encoding rate by simply inserting the STanH layer into the model again of the correct derivation. Note that, in principle, it is possible to consider multiple anchors trained for different rates, in which case it is preferable that the anchors are distributed evenly across the target rate range. In the section next we will experiment with different numbers of anchors and target rates with different LIC models. From fine-grained adaptation to continuous rate adaptation applications In image coding practices it is essential importance of controlling the rate at fine granularity, e.g. by fine-tuning the QP in codecs standardized (see reference [2]). The STanH activation function allows for rate adaptation in two ways. The first, the most direct, consists in refining a new STanH layer for the appropriate λ as described above, thus obtaining a control of the rate at fine granularity. If it is not possible to refine a new derivation (e.g. due to lack of resources or training samples), it will be possible to arrive at a continuous rate control by interpolating two existing leads as follows. Suppose we have two leads with corresponding layers STanH and STanH , obtaining two different points RD (r , q ) and (r , q ), with q > q and r > r . The 2 2 2 1 1 1 2 1 2 the aim here is to produce a third derivation STanH at the point RD(r, q) with 3 3 3 r > r > req > q > q . 1 3 2 1 3 2 Let (w, b) and (w, b) indicate the associated learnable parameters 1 1 2 2 respectively to STanH and STanH . Instead of defining the new STanH you can 1 2 3 interpolate a new set of parameters (w, b) as follows; from now on the models 3 3 of this type will be called interpolations. -33- where ρ ∈ (0, 1) is refined to match the desired target rate r > r > r 1 3 2 (with corresponding qualities q > q > q ). 1 3 2 Experiments The results of the experiments carried out by the Applicants will now be presented. The STanH activation function has been tested on three recent learned image compression architectures. In all experiments, we in fact, rely on the CompressAI project codebase (see Bégaint Jean, Racapé Fabien, Feltman Simon, and Pushparaja Akshay, “CompressAI: a PyTorch library and evaluation platform for end-to-end compression research”, arXiv preprint arXiv:2011.03029, 2020, [reference 43]) for Zou22 architectures (see reference

[17] , Xie21 (see reference

[19] ) and Cheng20 (see reference

[15] ). The impact of the STanH activation function was measured on the above models both in terms of RD performance and complexity, detecting that the STanH activation function allows you to perform image encoding at a variable rate with considerable savings in terms of training costs and deployment. Although in a practical scenario it would simply be necessary to refine a pre-trained anchor following the procedure outlined above, in these experiments the anchors were re-trained from scratch with the STanH module for two reasons: first, we wanted to measure the cost of training from zero and define an accurate baseline model to evaluate RD efficiency; secondly place, we also wanted to evaluate the STanH module in a fixed rate scenario in for which only models without derivations have been considered. Experimental setup We will now describe in detail how the three architectures mentioned above were trained with the STanH activation function used as a quantizer. In the following, the i-th anchor will be referred to as A, where A the 1 represents the point with the highest rate and the highest quality in the RD plane (i.e. the upper rightmost point on the curve). -34- The j-th derivation from the i-th anchor is denoted by D , where a value ij greater than j indicates a greater deviation on the RD graph from the anchor of reference (i.e. towards the lower left corner of the RD graph). Consistent with existing literature, the MSE (Mean Squared Error, (mean squared error) has been optimized as a bias metric in equation (11), and six different values ​​of λ, i.e. points, have been considered on the RD graph. During the inference time an arithmetic coding was performed for encode latent representations, using the torchac library (see Mentzer F. et al., “Practical Full Resolution Learned Lossless Image Compression”, IEEE Conference on Computer Vision and Pattern Recognition, 2019, [reference 44]). For the Cheng20 and Xie21 architectures, L=60 levels of quantization for both latent representations, and web were initialized to have uniform quantization over the range [−30, 30] for a total of 240 parameters. For Zou22, L was increased to 120 for the latent representation main ̂𝐲 (with Gaussian distribution) and L was reduced to 40 for the latent hyperprior representation; in this case, the number of parameters included in the two STanH modules it increased to 320. The K factor has been empirically fixed at K = 15, which regulates the speed of annealing of the inverse temperature β, doubling it when the cost function reaches a plateau for the first time, with a patience of 50 epochs. To train each anchor, 24K random samples were used from the OpenImages dataset (see Kuznetsova, A. et al., “The Open Images Dataset V4: Unified image classification, object detection, and visual relationship detection“, IJCV, 2020, dataset available from https: / / github.com / openimages, [reference 45]) and, depending on the architecture, the model was trained for ∼ 1-1.5M stages with batch size of 16 images, using the Adam optimizer (see Kingma Diederik P. et al., “Adam: A method for stochastic optimization,” Proceedings of the International Conference on Learning Representations, 2015, [reference 46]), -35- −4 with an initial learning rate of 10 which drops by a factor of 2 at reaching a plateau with patience of 50 epochs. The number of anchors to train is a hyperparameter that determines a trade-off between RD performance and training costs in terms of time and memory: this trade-off will be explored in detail later. Figure 3 lists different values ​​of λ used to train anchors of training for each reference model, considering the case of three anchors by model (actual values ​​were taken from the reference literature). All The models were trained on an NVIDIA A40 GPU. Finally, the STanH layers were refined to obtain different rates. Since each STanH layer consisting of only a few hundred learnable parameters, It was found that only about 8000 minutes were needed to refine the layer. samples from the training dataset. Each derivation was refined to 2-3 K stages, and patience for a reduction in the learning rate was reduced from 50 to 10 epochs. Figure 4 lists, for each architecture, the values ​​of λ used for refine the derivations, considering the case of three anchors (one derivation for each of them). It has been experimentally observed that it is possible to refine a derivation starting from a higher quality anchor or from the most close and moving in both directions from the desired bitrate, the latter approach returning a slightly higher RD efficiency. All models trained as described above were then evaluated on the Kodak PhotoCD image dataset (see Eastman Kodak Company, Kodak Lossless True Color Image Suite, 1999, http: / / r0k.us / graphics / kodak / , [reference 47]), on the Clic Professional validation and test dataset (see Toderici G. et al., “Workshop and challenge on learned image compression”, CVPR, 2021, [reference 48]) and on the Tecnik dataset (see Asuni N. et al., ”TESTIMAGES: a Large-scale Archive for Testing Visual Devices and Basic Image Processing Algorithms”, Proceedings of the Conference on Smart Tools and Applications in Computer Graphics, 2014, [reference 49]). The Kodak dataset includes 24 uncompressed images with a resolution -36- of 768×512, the Clic dataset includes 60 images with higher resolutions and variables, while the Tecnik dataset includes 100 images with a resolution of 1200×1200. Image quality (distortion) was rated as a ratio peak signal-to-noise ratio (PSNR), and secondarily in Multiscale Structural Similarity Terms (MS-SSIM) SIMilarity), (see Wang Z. et al., “Multiscale structural similarity for image quality assessment”, The Thirty-Seventh Asilomar Conference on Signals, Systems and Computers, 2003, Vol. 2., [reference 50]). The rate of compressed latent representations was measured in terms of bits per pixel (bpp) to account for different image resolutions. These metrics were plotted in the form of rate-bias curves, and pairs of curves were compared in terms of Bjøntegard metrics (see Bjøntegaard, Gisle, “Calculation of average PSNR differences between RD-curves”, VCEG-M33, 2001, [reference 51]). Please note that a negative BD-Rate (less bpps needed to get the same PSNR) and / or a positive BD-PSNR (higher PSNR at the same bpps) indicate greater coding efficiency. Experiments with the number of anchors As a first experiment, the trade-off between performance and complexity as a function of the number of anchors and leads. The experiment was conducted by reducing the number of anchors from six (all models trained end-to-end with a fixed-rate approach) to one (only one model trained end-to-end, while the other 5 were derived by refining only the STanH layers). Complexity was measured in terms of the number of learnable parameters, since both the training time and the cost of storage depend directly on it. As a reference, it was adopted the Zou22 architecture, where the model is trained with different lambdas and without STanH layer. Figure 5 shows the rate-distortion (RD) performance of the architecture. Zou22 on the Kodak dataset as a function of the different number of anchors, variable from six (a) to one (f), where the crosses represent the anchors and the circles represent the -37- refined derivations. Figure 6 shows the corresponding BD-Rate and BD-PSNR values ​​obtained with the method according to the present invention with respect to the Zou22 architecture on the Kodak test sets for different numbers of anchors, where savings are given in terms of trainable parameters (TP). The case with six anchors is indicated as a compliance check to show that STanH does not entail any penalty in terms of RD compared to the fixed rate reference quantization. As the number of anchors decreases, RD performance worsens slightly. However, the complexity decays much more rapidly, as shown in Figure 6. With three anchors, the BD-Rate drop remains within 1%, while the complexity is dramatically reduced by a factor of two. Finally, Figure 5(f) illustrates the limiting case of a single anchor and five derivations, in order to stimulate the potential of the method according to this invention. When the leads move away from the anchor, the RD performance the derivations degrade in proportion to this distance, and in any case not in an abrupt manner. Since the three-anchor configuration of Figure 5(d) provides a reasonable performance-complexity tradeoff (complexity reduced by ~50% with penalty of BD-Rate below 1%), this configuration will be referred to below. Rate-distortion performance The RD analysis of the experiments carried out by the Applicants was then extended to the Xie21 and Cheng20 architectures keeping the number of anchors at three. Figure 7 shows Rate-PSNR plots for the STanH-based method proposed by the invention and the related reference for Kodak datasets (row top), Clic (middle row) and Tecnik (bottom row) and for three anchors and three derivations. As an additional reference, a curve has been added for the H.266 / VVC VTM-20.2 reference encoder, see reference [2]. The method according to the present invention produces curves that almost completely overlap with the reference curves, which means that it has no negative effect on compression efficiency despite a -38- 50% reduction in complexity. Similar results can be observed also in Figure 8, where image quality is measured in terms of MS-SSIM (MS-SSIM converted to −10 log (1 − MS-SSIM)) for the Kodak dataset. Figure 9 compares the three-anchor model proposed by the invention with the references in terms of BD-Rate and BD-PSNR on the Kodak dataset, where the savings of memory are indicated in terms of trainable parameters. For architectures Zou22 and Cheng20 the BD-Rate loss is less than 1%, while for Xie21 it is remains well below 2% despite a reduction in complexity of over 50%, as will be discussed in detail later. Training cost A largely overlooked aspect of learned image compression is the cost of training the models from scratch, given that a single training It may take up to 10 days (see reference

[43] ) to produce a solution stable. On the other hand, with the method according to the present invention it is necessary update only the parameters in one or more quantization layers when refines an anchor by turning it into a derivative, i.e. less than 0.001% of the overall complexity of the model in most cases. We will now quantify the cost of training the models in terms of parameters to train or refine (TP), training time (TT) and consumption of energy (TC). For the reference models, the numbers shown in the original documentation; in other cases the models to produce the required numbers they were trained by the Applicants. For the method according to the present invention the scheme was considered usual in which three anchors are trained from scratch and three derivations are refined. Figure 10 shows a table of approximate costs in terms of trainable parameters (TP), training time (TT), training cost (TC) and memory (SG). “Total-reference” and “Total-proposed” indicate the cost of training of the six models, covering the entire BD range considered. Between brackets indicate the percentage gain of that particular field compared to the -39- reference. Figure 10 shows that the cost of refining a derivation is only one-tenth of the training cost of the reference model. In fact, refining an anchor means training, rather than a model deep convolutional, only 240-360 M (depending on model) parameters for each STanH layer. Consequently, the STanH activation function determines an energy saving varying between 33% (compared to the architecture Cheng20) and 45% (compared to Zou22 architecture) and a time saving of 48% training compared to Xie21 architecture to train three anchors and refine three derivations. Further savings can of course be achieved by replacing other anchors with derivations, at the price of slightly lower RD performance (see Figure 5). Figure 10 also shows that training an anchor with the function STanH activation requires slightly more time and energy than to the training of the reference model. It was observed that the annealing of the inverse temperature β up to reaching a stable configuration results in an increase in time of training. In addition, the limits of the integral according to formula (13) vary at each iteration depending on the parameters of the activation function STanH, and the calculation of these parameters can prolong the training. The method according to the invention allows you to obtain significant gains considering energy consumption and the total training time. It should be noted that these calculations are based on information from training provided in the original literature and on the use of resources computational resources of the Applicants to calculate the average energy consumption, multiplied by the hours needed to train the network. The energy value indicated is therefore an estimate of the real value; however, it allows us to appreciate the drastic improvement achievable by refining only the STanH layer. Storage cost -40- Another overlooked aspect of learned image compression is the need to store trained models on user devices, and especially on devices with limited resources such as mobile devices, set-top-boxes, Systems-on-a-Chip (SoCs), etc., where the memory is limited by project. Figure 10 presents (fourth column “SC” for each architecture) the requirements of memory for the pickle format, and please remember that the size of the models varies depending on the model and size of the latent spaces. The reference schemes must store six patterns, while the method according to the present invention it is necessary to store three (or fewer) anchors. With the method according to the present invention, storing the derivations It consists only of storing the few hundred parameters of the layers STanH refined. The reduction in storage costs amounts to approximately 50%: for the Cheng20 and Zou22 architectures the indicated savings are 49% and 50% respectively 53%. The most significant improvement is observed with the Xie21 architecture, where the footprint is reduced by about 57%. This is because the two anchors with the highest bit rate low are in this case smaller (with N = 128). It is hypothesized that these numbers could be further reduced by saving the models in some compressed format. Comparison with variable rate models The method according to the present invention was compared with Gain [reference 36], EVC [reference 40] and SCR [reference 37], i.e. three VBR codecs of the state of the art introduced previously. As for EVC and SCR, the numbers used as reference were indicated in the original documentation, since these codecs are based on ad-hoc training architectures and procedures. As regards Gain, it gets an adaptive quantization by fitting into a model, so as in the present invention, but is based on a model distribution ad-hoc entropy of the latent representation. For a fair comparison, the -41- Applicants have implemented gain units on the same Zou22 model adopted as a reference for the method according to the present invention. The training was carried out following the process described in the Original Gain document using six different qualities. In addition, a still alone (see A2 in Figure 3) to cover the entire range, since Gain is consists of a single model. Figure 11 represents a Kodak RD plot of the method according to the present invention with respect to Gain (reference

[36] ), on the Zou22 architecture, and compared to EVC (reference

[40] ) and SCR (reference

[37] ). Figure 11 shows that the method according to the present invention outperforms the performance of the three references in the vicinity of the A2 anchor (range 0.25-0.50 bpp). Figure 12 represents BD-Rate, BD-PSNR, number of parameters for variable bitrate (N. par. for VBR) and storage cost (SC) in GB of method according to the present invention with a single anchor with respect to Gain and EVC on an H.266 / VVC reference. As one moves away from the anchor, the RD efficiency of the method according to the The present invention slopes smoothly, and Figure 12 shows how the method according to the present invention still offers the best performance (minimum RD efficiency loss) on a H.266 / VVC VTM reference software, v. reference [2]. In terms of complexity, the method according to the present invention and Gain They have similar training costs and only one anchor needs to be trained from scratch. Storage costs are also comparable, as both methods require the storage of a single anchor plus a few thousand parameters additional ones that enable VBR encoding. As for EVC, it has introduced a dual a priori encoder that extrapolates a unit gain point per point to obtain bitstreams at different quality levels. For this reason it requires more parameters to achieve a variable bit rate (VBR); also this method is not agnostic to the model architecture (e.g. it is not possible use it as is on a channel-by-channel model like Zou22). -42- Continuous rate adjustment The ability of the method according to the present invention to achieve both fine-grained and continuous rate control using the interpolation strategy previously described. From the three initial anchors, 13 derivations in total were refined (4160 additional parameters), which were used to interpolate about 50 RD points supplementary, i.e. interpolations, to obtain a continuous adaptation of the badger. Figure 13 shows the resulting RD curves for the Zou22 architecture on the dataset Kodak, where the stars represent the anchors, the circles represent the derivations, and the empty squares are the interpolations. This suggests that interpolating STanH layers by inserting different values ​​of ρ into formula (14) we alter RD performance to a minimal extent, allowing for a rate to be achieved continuous variable. Figure 14 condenses into a single radar graph the function of STanH activation and seven different metrics to the reference schemes, namely Average PSNR (Avg-PSNR) and average bit rate (Avg-Rate), storage cost in GB (SC), number of trainable parameters (TP), training cost in kWh (TC), training time in hours (TT), and rate granularity (RG), defined as the average distance of rates between adjacent RD points. Except for Avg-PSNR, for all these metrics the principle is valid that the lower the value is the better, that is, a narrower radar profile corresponds to a better performance. The graph confirms that the STanH activation function ensures nearly identical RD performance, but at the cost of training and memory lower, improving all aspects considered compared to Zou22, including the advantage of continuous rate granularity. Figure 15 represents a second autoencoder 1' as a possible variant of the autoencoder in Figure 1. Autoencoder 1' is identical to autoencoder 1 except for the branch a hyperprior, which is missing. Autoencoder 1' includes a f which projects an input image x onto a image reconstruction -43- principal latent representation y of size M, which represents the number of channels, which is then quantized by quantizer 2, thus obtaining a discrete principal latent representation. y ˆ To enable the transmission of the main latent representation discrete from the encoding side to the decoding side of autoencoder 1, a y ˆ entropy encoder 4, specifically an arithmetic encoder, is configured to process the discrete principal latent representation y ˆ so as to provide a second compressed latent space 5 in the form of a bitstream, which is then fed to an entropy decoder 6, in particular a decoder arithmetic, to obtain a decompressed latent space corresponding to the discrete principal latent representation y ˆ. Finally, the discrete main latent representation is fed to a y ˆ image reconstruction decoder f , thereby obtaining s a reconstructed image x ˆ = g (y ˆ). s Although the 1' autoencoder is structurally simpler of autoencoder 1, quantizer 2 is implemented in the form of the previously described parameterized activation function STanH and It has the advantages already illustrated. In summary, an innovative method is proposed to convert LIC models to fixed rate into variable rates using STanH, a parametric module that approximates quantization. By definition, STanH converges in the step-by-step quantizer when its inverse temperature β is annealed appropriately during training. The variable rate is achieved by training end-to-end only few models still and therefore only refining the STanH layers for others RD trade-offs in different derivation models. Once the anchors are trained, the refinement of the additional leads has negligible training and memorization costs and, by calculating a weighted average of pre-existing STanH, practically offers a rate control both at fine granularity is continuous. In summary, it has been demonstrated that the method according to the present invention -44- achieves results comparable to those of fixed-rate and interest-rate LIC models variable; furthermore, thanks to its simplicity, it is totally agnostic to the reference architecture. This description has illustrated some of the possible variants, but it will be clear to the person skilled in the art how practical implementation is possible also other embodiments, with different elements replaceable by others technically equivalent. The present invention is therefore not limited to the examples illustrative described here, but is subject to numerous changes, improvements or replacements of parts and elements that are equivalent to each other without however departing from them from the basic inventive idea, as specified in the following claims. -45- LEGEND OF THE DRAWING TABLES FIG. 1 Arithmetic encoder Channel-wise Autoregressive Entropy Autoregressive Channel-wise Autoregressive Entropy Model for Entropy model channel FIG. 1a Slice Slice Code slice Code slice Factorized Entropy Model Hyperprior Hyperprior FIG. 2 discrete-soft-quantized latent discrete / quantized latent representation soft representation Original latent representation FIG. 3 Model Model FIG. 4 Model Model λ's for derivations  values ​​for derivations FIG. 5 One-two-three-four-five-six Anchors FIG. 6 Anchors Anchors derivations BD-rate BD-Rate TP-proposed TP-proposed Savings Savings FIG. 7 Proposed Reference Reference FIG. 9 TP-ref TP-ref FIG. 10 Reference single-model Reference – single model Proposed-anchor Proposed-derivation Reference-total Proposed-total FIG. 11 GainUnits Gain units our FIG. 12 #Pars for N. par. for -46-

Claims

1. Learned image compression method implemented in a autoencoder (1') including an image reconstruction encoder (f ) and an image reconstruction decoder (f ), called method as including the steps of: a) extract from an image () 𝐱 a principal latent representation (y) for means of said image reconstruction encoder (f ); to b) quantize said principal latent representation (y) by means of a quantizer (2) to obtain a discrete principal latent representation ̂ () 𝐲 ; c) entropically encode said discrete principal latent representation ̂ () 𝐲 by means of an entropy encoder (4) to obtain a bitstream (5); d) entropically decode said bitstream (5) by means of a decoder entropic (6) to obtain an entropically decoded bitstream; e) feeding said entropically decoded bitstream to said decoder image reconstruction (fs); f) recover a reconstructed image ̂ () 𝐱 by means of said decoder image reconstruction (f ); s g) train said autoencoder (3) by standard gradient descent of the back-propagated error gradient by minimizing a cost function distortion rate L relaxing said discrete principal latent representation ̂ (𝐲) by means of a soft quantized principal latent representation (y ˜ ), said method being characterized by the fact that said quantizer (2) is implemented in the form of a parameterized activation function where L is a number of quantization levels sought, β is a parameter of inverse temperature which regulates a slope of said quantization levels, and web are parameters that determine the levels of reconstruction and the width of the quantization intervals of said latent representation soft quantized main (y ˜ ). -47- 2. Method according to claim 1, wherein said parameter w for determine said reconstruction levels and said parameter b to determine said width of said quantization intervals are learned to minimize said L-rate-distortion cost function.

3. The method of claim 2, wherein said rate-cost function distortion L is in the form ℒ = R + λ ∙ D, where λ is a hyperparameter that governs the compromise between bit-rate R of the main latent representation (y) and the distortion D of said reconstructed image ̂ () 𝐱 .

4. A method according to any of claims 1 to 3, wherein said inverse temperature parameter β gradually increased during training with an annealing procedure.

5. The method of claim 4, wherein said annealing procedure is It is based on a function that considers both the number of training iterations be the difference between said soft quantized principal latent representation (y ˜ ) and called discrete principal representation ̂ () 𝐲 .

6. A method according to any of claims 1 to 5, wherein said inverse temperature parameter β is calculated as: where t is the t-th training phase, where e are respectively the quantization errors of the latent representation principal soft quantized representation (y ˜) and the discrete quantized latent representation ̂ (𝐲) , where is the error between said quantization errors at the phase of training t, where βt represents the value used at the t-th stage, and where K is a factor that regulates the speed with which this representation is frozen soft quantized principal latent (y ˜ ).

7. Learned image compression method implemented in a autoencoder (1) comprising an image reconstruction encoder (f ) and an image reconstruction decoder (f ), called method as -48- including the steps of: a) extract from an image () 𝐱 a principal latent representation (y) for means of said image reconstruction encoder (f ) and a to latent hyperprior representation (z) by means of a transformation block of hyperprior analysis (ha); b) quantize said principal latent representation (y) by means of a first quantizer (2) to obtain a discrete principal latent representation ̂ (𝐲) and called the hyperprior latent representation (z) by means of a second quantizer (3) to obtain a discrete hyperprior latent representation ( ˆ z); c) entropically encode said discrete principal latent representation ̂ () 𝐲 by means of a first entropy encoder (4) to obtain a first bitstream (5) and said discrete hyperprior latent representation ( ˆ z) by means of a second entropy encoder (7) to obtain a second bitstream (8); d) entropically decode said first bitstream (5) by means of a first entropy decoder (6) to obtain a first decoded bitstream entropically and said second bitstream (8) by means of a second entropy decoder (9) to obtain a second decoded bitstream entropically; e) feed said first (5) and second (8) entropically decoded bitstreams to called image reconstruction decoder (f ); s f) recover a reconstructed image ̂ () 𝐱 by means of said decoder image reconstruction (f ); s g) train said autoencoder (3) by standard gradient descent of the back-propagated error gradient by minimizing a cost function distortion rate L relaxing said discrete principal latent representation ̂ (𝐲) by means of a soft quantized principal latent representation (y ˜) and called discrete hyperprior latent representation ( ˆ z) by means of a soft quantized hyperprior latent representation ̃(𝐳) , said method being characterized by the fact that said quantizers (2,3) are implemented in the form of respective parameterized activation functions, in which -49- where t indicates the t-th training phase, L is a number of training levels quantization sought, β is an inverse temperature parameter that governs a slope of said quantization levels, web are parameters that determine the reconstruction levels and the width of the intervals respectively quantization of said soft quantized principal latent representations (y ˜̃ , 𝐳 ), and the subscripts {h,m} indicate the two different latent representations, namely the hyperprior one and the principal one respectively.

8. Method according to claim 7, wherein said parameter w for determine said reconstruction levels and said parameter b to determine said width of said quantization intervals are learned to minimize said L-rate-distortion cost function.

9. The method of claim 8, wherein said rate-cost function distortion L is where d is a distortion metric, λ is a hyperparameter that governs the compromise between bit-rate R of said main latent representation (y) and distortion D of the said reconstructed image ̂ () 𝐱 , represents a rate of said latent representation at hyperprior (z), and represents a rate of said principal latent representation (y) from which the image is reconstructed.

10. Method according to claim 8 or 9, wherein said parameters of inverse temperature β and β are gradually increased during h,tm,t training with an annealing procedure.

11. The method of claim 10, wherein said annealing procedure is It is based on a function that considers both the number of training iterations let it be a difference between said soft quantized principal latent representation ̃ () 𝐲 and said discrete principal latent representation ̂ () 𝐲 is a difference between said -50- soft quantized hyperprior latent representation ̃(𝐳) and said representation latent discrete hyperprior ( ˆ z).

12. Method according to claim 10 or 11, wherein said parameter of inverse temperature β is calculated as: m,t where t is the t-th training phase, where e are respectively the quantization errors of the latent representation principal quantized soft ̃ () 𝐲 and the quantized latent representation discrete ̂ () 𝐲 , where is the error between said quantization errors at the phase of training t, and where K is a factor that regulates the speed with which it is frozen so-called self-quantized latent representation; and the said inverse temperature parameter β is calculated as: h,t 2 2 ‖ ‖ ‖ ‖ where t is the t-th training phase, where e ̃ = z ̃ − zee ̂ = z ̂ − z are tt respectively the quantization errors of the latent representation a soft quantized hyperprior (z ̃) and of said quantized hyperprior representation discrete ̂ (𝐳 ), E = ⌈e ̂ − e ̃ ⌉ is the error between said quantization errors at the phase of ttt training t, and where K is a factor that regulates the speed with which it is frozen called soft quantized hyperprior latent representation (z ̃).

13. Autoencoder (1') for learned image compression, including: - an image reconstruction encoder (f ) configured to extract from to an image () 𝐱 a principal latent representation (y); - a quantizer (2) configured to quantize said latent representation principal (y) to obtain a discrete principal latent representation ̂ () 𝐲 ; - an entropy encoder (4) configured to entropically encode said -51- discrete principal latent representation ̂ () 𝐲 to obtain a bitstream (5); - an entropy decoder (6) configured to entropically decode said bitstream (5) to obtain an entropically decoded bitstream; - an image reconstruction decoder (f ) configured to receive s called entropically decoded bitstream; - an image reconstruction decoder (f ) configured to recover s a reconstructed image ̂ () 𝐱 ; - means for training said autoencoder (1') by gradient descent standard of the backpropagated error gradient by minimizing a function of cost rate-distortion L relaxing said main latent representation discrete ̂ () 𝐲 by means of a soft quantized principal latent representation (y ˜ ), said autoencoder (1') being characterized by the fact that said quantizer (2) is implemented in the form of a parameterized activation function where L is a number of quantization levels sought, β is a parameter of inverse temperature which regulates a slope of said quantization levels, and web are parameters that determine the levels of reconstruction and the width of the quantization intervals of said latent representation soft quantized main (y ˜ ).

14. An autoencoder (1) for learned image compression, including: - an image reconstruction encoder (f ) configured to extract from to an image () 𝐱 a main latent representation (y) and a block of hyperprior analysis transformation (h ) configured to extract from said to image (𝐱) a latent hyperprior representation (z); - a first quantizer (2) configured to quantize said representation principal latent (y) to obtain a discrete principal latent representation ̂ (𝐲) and a second quantizer (3) configured to quantize said -52- hyperprior latent representation (z) to obtain a latent representation a discrete hyperprior ( ˆ z); - a first entropy encoder (4) configured to entropically encode called discrete principal latent representation ̂ () 𝐲 to obtain a first bitstream (5) and a second entropy encoder (7) configured to encode entropically called discrete hyperprior latent representation ( ˆ z) to obtain a second bitstream (8); - a first entropy decoder (6) configured to decode entropically called first bitstream (5) and a second entropic decoder (9) configured to entropically decode said second bitstream (8) for obtain a second entropically decoded bitstream; - an image reconstruction decoder (f ) configured to receive s said first (5) and second (8) entropically decoded bitstreams; - an image reconstruction decoder (f ) configured to recover s a reconstructed image ̂ () 𝐱 ; - means for training said autoencoder (1) by gradient descent standard of the backpropagated error gradient by minimizing a function of cost rate-distortion L relaxing said main latent representation discrete ̂ () 𝐲 by means of a soft quantized principal latent representation (y ˜ ) and called discrete hyperprior latent representation ( ˆ z) by means of a soft quantized hyperprior latent representation ̃(𝐳) , said autoencoder (1) being characterized by the fact that said first (2) and said second (3) quantizer are implemented in the form of respective parameterized activation functions where t indicates the t-th training phase, L is a number of training levels quantization sought, β is an inverse temperature parameter that governs a slope of said quantization levels, web are parameters that determine -53- the reconstruction levels and the amplitude of the quantization levels respectively of said soft quantized principal latent representations (y ˜,̃ 𝐳 ), and the subscripts {h,m} indicate the two different latent representations, namely respectively the one a hyperprior and the main one.

15. A variable rate image compression method implemented in a device, the method comprising: - train one or more models from scratch by still selecting appropriate λ values for placement on a target rate-distortion (RD) curve; - generate one or more derivations from each of the still-trained models cloning the still-trained model and setting a smaller λ value for aim for a lower rate; - resume the training procedure for each derivation, in which they are only the quantization layers related to the activation function were refined parameterized according to claims 1 and 7, and all other parameters of the derivation are kept unchanged with respect to the reference model; - store only the refined quantization layers after the completion of the refinement process, in which all the layers of the derivation, except the layers of refined quantization, are identical to the still model; and - enable variable rate image compression in that device replacing a current quantization layer with that of a refined anchor to switch rates without the need to train a separate model for every rate. -54-