Skip to main content
. 2024 Jun 30;24(13):4253. doi: 10.3390/s24134253
Algorithm 1 Sample Compression Algorithm
  • Input: 

    n images with size s×t, the compression ratio μ and the iteration number b.

  • Output: 

    n compressed images with size μs×t.

    (xi stands for the ith input image, img_samplei and img_constructi represent the ith output image and its reconstruction form, respectively, and img_sampleiv and img_constructiv represent the vth pixel value in the ith output image and its reconstruction form, respectively).

  • 1:

     initialize the g_loss to infinity, the kernel_size to 1μ×1μ, the stride to 1μ, padding to 0 and bias to False.

  • 2:

     for k=0 to b1 do

  • 3:

        for i=0 to n1 do

  • 4:

          img_samplei  Conv2d(xi)

  • 5:

          img_constructi  ReconstructionModule(img_samplei)

  • 6:

          g_loss  v=1s×timg_constructivxiv2×1s×t

  • 7:

        end for

  • 8:

        Conv2d  Optimizer(g_loss)

  • 9:

     end for

  • 10:

    img_samplei  Conv2d(xi)

  • 11:

    return img_samplei