Learning Better Lossless Compression · 2020. 6. 17. · Fabian Mentzer Luc Van Gool Michael...

16
Learning Better Lossless Compression Using Lossy Compression Fabian Mentzer Luc Van Gool Michael Tschannen

Transcript of Learning Better Lossless Compression · 2020. 6. 17. · Fabian Mentzer Luc Van Gool Michael...

  • Learning Better Lossless Compression Using Lossy CompressionFabian Mentzer Luc Van Gool Michael Tschannen

  • What and Why

    BPG xl Residual x – xl

    Residual is centered closely around 0 →

    Encode residual of lossy image compression algorithm BPG to do lossless compression.

    -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6

    BPG x

  • Background: Arithmetic Coding

    ~ p

    Setup: Finite set of symbols, the probability of a symbol occurring is given by the probability distribution p.

    We can encode a stream of symbols losslessly to a bistream with Arithmetic Coding.

    , ,

    Set of symbols:

  • Background: Arithmetic Coding

    i.i.d. ~ p

    This is an example stream. p( ) is higher, so we want to use fewer bits when encoding a banana symbol! That’s what arithmetic coding does.

    Set of symbols:

    ~ p, ,

    Setup: Finite set of symbols, the probability of a symbol occurring is given by the probability distribution p.

    We can encode a stream of symbols losslessly to a bistream with Arithmetic Coding.

    Stream of symbols:

  • Background: Arithmetic Coding

    bitstream

    Stream of symbols:

    i.i.d. ~ p arithmetic encoder

    Arithmetic coding assigns a bit-sequence to each symbol, such that more likely symbols get shorter sequences. We encode the stream of symbols into one bitstream.

    ~ p, ,

    Setup: Finite set of symbols, the probability of a symbol occurring is given by the probability distribution p.

    We can encode a stream of symbols losslessly to a bistream with Arithmetic Coding.

    Set of symbols:

  • Background: Arithmetic Coding

    arithmetic decoder

    Decoding recovers the stream

    bitstream

    Stream of symbols:

    i.i.d. ~ p arithmetic encoder

    Set of symbols:

    ~ p, ,

    Setup: Finite set of symbols, the probability of a symbol occurring is given by the probability distribution p.

    We can encode a stream of symbols losslessly to a bistream with Arithmetic Coding.

  • Background: Arithmetic Coding

    Set of symbols:

    ~ p, ,

    Problem: In general, we don’t know p. So we learn a model p’ for it by minimizing the cross-entropy H(p, p’). This is the same as minimizing the negative log likelihood of p’ over mini-batches.

  • Lossless Compression

    BPG xl Residual x – xlBPG xSo, to encode this residual, all we need is a model p(r).

  • How

    BPG

    Bitstream

    QCx

    xl

    Encoding1. Get quality factor Q for BPG from the learned Q-classifier (QC). 2. Encode input x with BPG using that Q, get xl and save to bitstream.

  • How

    RC

    BPG

    Bitstream

    QC

    xl

    xp(r|xl)

    3. Feed xl to the learned Residual Compressor (RC), which predicts the conditional PMF p(r|xl).

    Encoding

  • How

    −AAAC1HicbVFdb9MwFHXDx0b56gZvvFh0kzZUqqR7YBIqqsQLj0Oi3aQkqhznZrVqO5Ht0BWTJ8QTEq/8Dl7hl/BvcNJV2tZdKdLxOb73xOcmBWfa+P6/lnfn7r37W9sP2g8fPX7ytLOzO9F5qSiMac5zdZYQDZxJGBtmOJwVCohIOJwm8/e1fvoZlGa5/GSWBcSCnEuWMUqMo6ad/YgyRTmkNjJwYZqBNuGEziu7FyXCvq72qmra6fp9vym8CYJL0B09R02dTHdav6I0p6UAaSgnWoeBX5jYEmWYc6vaUamhcC7kHEIHJRGgY9vYV3jfMSnOcuU+aXDDXu2wRGi9FIm7KYiZ6ZtaTd6qXawNNqVE3EaHpcmOY8tkURqQdPVrWcmxyXEdJ06ZAmr40gFCFXOvw3RGFKHGhX7NwLD5F/duCQuaC0Fk+modfRjELn0nh+tNDg/qIf36eBjbNr5SkcxTCPWMFDBc9fcyxvlwMWMGeqkiix6TEhR2zsOByxw3sw6x7QbV22aVwc3FbYLJoB8c9Qcfg+7o3WqnaBu9QC/RAQrQGzRCH9AJGiOKfqDf6A/66028r9437/vqqte67HmGrpX38z/27uLo

    Arithmetic Coding

    RC

    BPG

    Bitstream

    QC

    xl

    x

    rp(r|xl)

    4. Calculate residual r = x – xl. 5. Encode r using PMF p(r|xl)

    with Arithmetic coding.

    Encoding

  • How

    −AAAC1HicbVFdb9MwFHXDx0b56gZvvFh0kzZUqqR7YBIqqsQLj0Oi3aQkqhznZrVqO5Ht0BWTJ8QTEq/8Dl7hl/BvcNJV2tZdKdLxOb73xOcmBWfa+P6/lnfn7r37W9sP2g8fPX7ytLOzO9F5qSiMac5zdZYQDZxJGBtmOJwVCohIOJwm8/e1fvoZlGa5/GSWBcSCnEuWMUqMo6ad/YgyRTmkNjJwYZqBNuGEziu7FyXCvq72qmra6fp9vym8CYJL0B09R02dTHdav6I0p6UAaSgnWoeBX5jYEmWYc6vaUamhcC7kHEIHJRGgY9vYV3jfMSnOcuU+aXDDXu2wRGi9FIm7KYiZ6ZtaTd6qXawNNqVE3EaHpcmOY8tkURqQdPVrWcmxyXEdJ06ZAmr40gFCFXOvw3RGFKHGhX7NwLD5F/duCQuaC0Fk+modfRjELn0nh+tNDg/qIf36eBjbNr5SkcxTCPWMFDBc9fcyxvlwMWMGeqkiix6TEhR2zsOByxw3sw6x7QbV22aVwc3FbYLJoB8c9Qcfg+7o3WqnaBu9QC/RAQrQGzRCH9AJGiOKfqDf6A/66028r9437/vqqte67HmGrpX38z/27uLo

    Arithmetic Coding

    RC RC

    BPG

    Bitstream

    QC

    xl

    x

    rp(r|xl) p(r|xl)

    Decoding1. Obtain xl from the bitstream. 2. Feed xl into RC to get PMF

    p(r|xl).

    xl

  • r

    How

    −AAAC1HicbVFdb9MwFHXDx0b56gZvvFh0kzZUqqR7YBIqqsQLj0Oi3aQkqhznZrVqO5Ht0BWTJ8QTEq/8Dl7hl/BvcNJV2tZdKdLxOb73xOcmBWfa+P6/lnfn7r37W9sP2g8fPX7ytLOzO9F5qSiMac5zdZYQDZxJGBtmOJwVCohIOJwm8/e1fvoZlGa5/GSWBcSCnEuWMUqMo6ad/YgyRTmkNjJwYZqBNuGEziu7FyXCvq72qmra6fp9vym8CYJL0B09R02dTHdav6I0p6UAaSgnWoeBX5jYEmWYc6vaUamhcC7kHEIHJRGgY9vYV3jfMSnOcuU+aXDDXu2wRGi9FIm7KYiZ6ZtaTd6qXawNNqVE3EaHpcmOY8tkURqQdPVrWcmxyXEdJ06ZAmr40gFCFXOvw3RGFKHGhX7NwLD5F/duCQuaC0Fk+modfRjELn0nh+tNDg/qIf36eBjbNr5SkcxTCPWMFDBc9fcyxvlwMWMGeqkiix6TEhR2zsOByxw3sw6x7QbV22aVwc3FbYLJoB8c9Qcfg+7o3WqnaBu9QC/RAQrQGzRCH9AJGiOKfqDf6A/66028r9437/vqqte67HmGrpX38z/27uLo

    Arithmetic Coding

    Arithmetic Coding

    RC RC

    BPG

    Bitstream

    QC

    xl

    x

    rp(r|xl) p(r|xl)

    xl

    3. Decode r from the bitstream, using the PMF p(r|xl) and arithmetic coding.

    Decoding

  • How

    +AAAC03icbVFNb9MwGHbD1yhfHRy5WLRDG1RVUg6bQEWVuHAcEt0mJVHlOG9bq7YT2Q5dsXJBnJB25j/sxBX+BUf+DU66Stu6V7L0+Hne7zfJOdPG9/81vFu379y9t3W/+eDho8dPWttPj3RWKAojmvFMnSREA2cSRoYZDie5AiISDsfJ/EOlH38BpVkmP5tlDrEgU8kmjBLjqHGrExk4NXUeO1VkWdqIMkU5pLYTJcK+LjtlOW61/Z5fG94EwQVoD3fOz9/+PXt5ON5u/IzSjBYCpKGcaB0Gfm5iS5RhLnfZjAoNOaFzMoXQQUkE6NjWbZR4xzEpnmTKPWlwzV6OsERovRSJ8xTEzPR1rSJv1E7XBTalRNxEh4WZHMSWybwwIOmqtUnBsclwtU2cMgXU8KUDhCrmpsN0RhShxu38SgHD5l/d3BIWNBOCyPTVetFhENuoksP1IQe7VZJe9d2LbRNfskhmKYR6RnIYrOK7E8b5YDFjBrqpIosukxIUdpUHfbdzXOfaw7YdlO/qUwbXD7cJjvq94E2v/yloD9+jlW2h5+gF2kUB2kdD9BEdohGi6Af6hX6jP97Is9437/vK1WtcxDxDV8w7+w+96eW1

    −AAAC1HicbVFdb9MwFHXDx0b56gZvvFh0kzZUqqR7YBIqqsQLj0Oi3aQkqhznZrVqO5Ht0BWTJ8QTEq/8Dl7hl/BvcNJV2tZdKdLxOb73xOcmBWfa+P6/lnfn7r37W9sP2g8fPX7ytLOzO9F5qSiMac5zdZYQDZxJGBtmOJwVCohIOJwm8/e1fvoZlGa5/GSWBcSCnEuWMUqMo6ad/YgyRTmkNjJwYZqBNuGEziu7FyXCvq72qmra6fp9vym8CYJL0B09R02dTHdav6I0p6UAaSgnWoeBX5jYEmWYc6vaUamhcC7kHEIHJRGgY9vYV3jfMSnOcuU+aXDDXu2wRGi9FIm7KYiZ6ZtaTd6qXawNNqVE3EaHpcmOY8tkURqQdPVrWcmxyXEdJ06ZAmr40gFCFXOvw3RGFKHGhX7NwLD5F/duCQuaC0Fk+modfRjELn0nh+tNDg/qIf36eBjbNr5SkcxTCPWMFDBc9fcyxvlwMWMGeqkiix6TEhR2zsOByxw3sw6x7QbV22aVwc3FbYLJoB8c9Qcfg+7o3WqnaBu9QC/RAQrQGzRCH9AJGiOKfqDf6A/66028r9437/vqqte67HmGrpX38z/27uLo

    rArithmetic Coding

    Arithmetic Coding

    RC RC

    BPG

    Bitstream

    QC

    xl

    x

    r

    xp(r|xl) p(r|xl)

    xl

    4. Obtain x = r + xl.Decoding

  • Results

    0 1 2 3 4

    Learned

    Non-Learned

    +44%

    +9.5%

    +9.2%

    PNG

    JPEG2k-LL

    WebP-LL

    FLIF

    L3C

    Ours

    [Mean Bits Per Sub-Pixel on OpenImages]

    +2.8%

    +7.2%

    State of the Art on Open Images, where we train.

  • Results

    0 1 2 3 4

    Lear

    ned

    Non

    -Lea

    rned

    PNG

    JPEG2k-LL

    WebP-LL

    FLIF

    L3C

    Ours

    CLIC.mobile

    Better than previous learned method (L3C) on other datasets

    1.5 2.5 3.5 4.5CLIC.pro

    1.5 2.5 3.5 4.5DIV2K

    +54%

    +7.2%

    +9.3%

    +4.9%

    -1.8%

    +36%

    +2.3%

    +2.5%

    +0.4%

    -5.1%

    +38%

    +1.6%

    +3.2%

    +0.5%

    -5.5%