CN110933432A - Image compression method, image decompression method, image compression device, image decompression device, electronic equipment and storage medium - Google Patents

Image compression method, image decompression method, image compression device, image decompression device, electronic equipment and storage medium Download PDF

Info

Publication number
CN110933432A
CN110933432A CN201811095462.0A CN201811095462A CN110933432A CN 110933432 A CN110933432 A CN 110933432A CN 201811095462 A CN201811095462 A CN 201811095462A CN 110933432 A CN110933432 A CN 110933432A
Authority
CN
China
Prior art keywords
image
compressed
resolution
network
compressed data
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201811095462.0A
Other languages
Chinese (zh)
Inventor
邓斌
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Kingsoft Office Software Inc
Zhuhai Kingsoft Office Software Co Ltd
Guangzhou Kingsoft Mobile Technology Co Ltd
Original Assignee
Beijing Kingsoft Office Software Inc
Zhuhai Kingsoft Office Software Co Ltd
Guangzhou Kingsoft Mobile Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Kingsoft Office Software Inc, Zhuhai Kingsoft Office Software Co Ltd, Guangzhou Kingsoft Mobile Technology Co Ltd filed Critical Beijing Kingsoft Office Software Inc
Priority to CN201811095462.0A priority Critical patent/CN110933432A/en
Priority to PCT/CN2019/106149 priority patent/WO2020057492A1/en
Publication of CN110933432A publication Critical patent/CN110933432A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T3/00Geometric image transformations in the plane of the image
    • G06T3/40Scaling of whole images or parts thereof, e.g. expanding or contracting
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T9/00Image coding
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/30Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using hierarchical techniques, e.g. scalability
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/42Methods or arrangements for coding, decoding, compressing or decompressing digital video signals characterised by implementation details or hardware specially adapted for video compression or decompression, e.g. dedicated software implementation

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Compression Of Band Width Or Redundancy In Fax (AREA)
  • Compression Or Coding Systems Of Tv Signals (AREA)

Abstract

The embodiment of the application provides an image compression method, an image decompression method, an image compression device, an image decompression device, an electronic device and a storage medium, and the method comprises the following steps: acquiring an image to be compressed; compressing an image to be compressed by utilizing a convolutional neural network model to obtain network compressed data; the convolutional neural network model is obtained by training with a preset training set, wherein the training set comprises a plurality of low-resolution images with the resolution lower than a resolution threshold value and images with the resolution higher than the resolution threshold value corresponding to the low-resolution images; and storing the network compressed data. By applying the embodiment of the application, the resolution loss when the compressed image is viewed is reduced, and the user experience is improved.

Description

Image compression method, image decompression method, image compression device, image decompression device, electronic equipment and storage medium
Technical Field
The present application relates to the field of image processing technologies, and in particular, to an image compression method, an image decompression device, an electronic device, and a storage medium.
Background
At present, in order to reduce the storage space occupied by an image, facilitate the transmission of the image, and the like, the image is often required to be size-compressed, the size of the image is reduced, and the resolution of the image is reduced. For example, an image of 100 × 100 pixels is compressed into an image of 50 × 50 pixels. But this compression is a lossy compression. When the image needs to be viewed, only the compressed image, that is, the image with low resolution, can be viewed, and the user experience is poor.
Disclosure of Invention
An object of the embodiments of the present application is to provide an image compression method, an image decompression method, an image compression device, an image decompression device, an electronic apparatus, and a storage medium, so as to reduce resolution loss when a compressed image is viewed and improve user experience. The specific technical scheme is as follows:
in a first aspect, an embodiment of the present application provides an image compression method, where the method includes:
acquiring an image to be compressed;
compressing the image to be compressed by using a CNN (Convolutional Neural Network) model to obtain Network compression data; the CNN model is obtained by training a preset training set, wherein the training set comprises a plurality of low-resolution images with the resolution lower than a resolution threshold value and images with the resolution higher than the resolution threshold value corresponding to the low-resolution images;
and storing the network compressed data.
Optionally, the method further includes:
after the image to be compressed is obtained, carrying out size compression on the image to be compressed to obtain a size compressed image;
after the network compressed data is obtained, storing the relation between the size compressed image and a preset identifier; the preset identification is used for indicating that the network compressed data of the image to be compressed exists.
Optionally, the image to be compressed is located in a PDF document; or the image to be compressed is positioned in the Word document; or the image to be compressed is positioned in an Excel document.
In a second aspect, an embodiment of the present application provides an image decompression method, where the method includes:
acquiring network compressed data of a target image;
decompressing the network compressed data by using a CNN model to obtain a decompressed image; the CNN model is obtained by training a preset training set, wherein the training set comprises a plurality of low-resolution images with the resolution lower than a resolution threshold value and images with the resolution higher than the resolution threshold value corresponding to the low-resolution images;
outputting the decompressed image.
Optionally, the step of obtaining the network compressed data of the target image includes:
acquiring a size compressed image of a target image;
judging whether a preset identification corresponding to the size compressed image is stored or not; the preset identification is used for indicating that network compressed data of the target image exist;
and if the network compressed data is stored, acquiring the network compressed data.
Optionally, the method further includes:
and if the preset identification corresponding to the size compressed image is not stored, outputting the size compressed image.
In a third aspect, an embodiment of the present application provides an image compression apparatus, including:
the acquisition module is used for acquiring an image to be compressed;
the first compression module is used for compressing the image to be compressed by utilizing a CNN model to obtain network compressed data; the CNN model is obtained by training a preset training set, wherein the training set comprises a plurality of low-resolution images with the resolution lower than a resolution threshold value and images with the resolution higher than the resolution threshold value corresponding to the low-resolution images;
and the first storage module is used for storing the network compressed data.
Optionally, the apparatus further comprises:
the second compression module is used for carrying out size compression on the image to be compressed after the image to be compressed is obtained, so as to obtain a size compressed image;
the second storage module is used for storing the relation between the size compressed image and a preset identifier after the network compressed data is obtained; the preset identification is used for indicating that the network compressed data of the image to be compressed exists.
Optionally, the image to be compressed is located in a PDF document; or the image to be compressed is positioned in the Word document; or the image to be compressed is positioned in an Excel document.
In a fourth aspect, an embodiment of the present application provides an image decompression apparatus, including:
the acquisition module is used for acquiring network compressed data of the target image;
the decompression module is used for decompressing the network compressed data by utilizing the CNN model to obtain a decompressed image; the CNN model is obtained by training a preset training set, wherein the training set comprises a plurality of low-resolution images with the resolution lower than a resolution threshold value and images with the resolution higher than the resolution threshold value corresponding to the low-resolution images;
an output module for outputting the decompressed image.
Optionally, the obtaining module is specifically configured to obtain a size-compressed image of the target image; judging whether a preset identification corresponding to the size compressed image is stored or not; the preset identification is used for indicating that network compressed data of the target image exist; and if the network compressed data is stored, acquiring the network compressed data.
Optionally, the output module is further configured to output the size-compressed image if the preset identifier corresponding to the size-compressed image is not stored.
In a fifth aspect, an embodiment of the present application provides an electronic device, which includes a processor, a communication interface, a memory, and a communication bus, where the processor, the communication interface, and the memory complete communication with each other through the communication bus;
the memory is used for storing a computer program;
the processor is configured to execute the program stored in the memory to implement any of the image compression method steps provided in the first aspect.
In a sixth aspect, an embodiment of the present application provides an electronic device, which includes a processor, a communication interface, a memory, and a communication bus, where the processor, the communication interface, and the memory complete communication with each other through the communication bus;
the memory is used for storing a computer program;
the processor is configured to execute the program stored in the memory to implement any of the image decompression method steps provided in the second aspect.
In a seventh aspect, an embodiment of the present application provides a machine-readable storage medium, where a computer program is stored in the machine-readable storage medium, and when the computer program is executed by a processor, the computer program implements any one of the image compression method steps provided in the first aspect.
In an eighth aspect, the present application provides a machine-readable storage medium, in which a computer program is stored, and when the computer program is executed by a processor, the computer program implements any one of the image decompression method steps provided in the second aspect.
The embodiment of the application provides an image compression method, an image decompression method, an image compression device, an image decompression device, electronic equipment and a storage medium, wherein a CNN model is obtained by training a plurality of images lower than a resolution threshold value and a plurality of images higher than the resolution threshold value. And compressing the image by adopting a CNN model to obtain network compressed data with lower resolution so as to reduce the occupied storage space. And then, decompressing the network compressed data by using the CNN model to obtain a decompressed image. Because the CNN is obtained by training a plurality of images lower than the resolution threshold and a plurality of images higher than the resolution threshold, a decompressed image with a higher resolution can be obtained by using the CNN model, and even the resolution of the decompressed image is higher than that of the original image. This effectively reduces the loss of resolution when viewing the compressed image and improves the user experience. Of course, it is not necessary for any product or method of the present application to achieve all of the above-described advantages at the same time.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present application, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a first flowchart of an image compression method according to an embodiment of the present application;
fig. 2 is a schematic flowchart of a CNN model training method according to an embodiment of the present disclosure;
fig. 3 is a second flowchart of an image compression method according to an embodiment of the present application;
fig. 4 is a first flowchart of an image decompression method according to an embodiment of the present application;
fig. 5 is a second flowchart of an image decompression method according to an embodiment of the present application;
fig. 6 is a schematic diagram of a first structure of an image compression apparatus according to an embodiment of the present application;
fig. 7 is a schematic diagram of a second structure of an image compression apparatus according to an embodiment of the present application;
fig. 8 is a schematic diagram of a first structure of an image decompression apparatus according to an embodiment of the present application;
fig. 9 is a schematic structural diagram of a first electronic device according to an embodiment of the present application;
fig. 10 is a schematic structural diagram of a second electronic device according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
In order to reduce the loss of resolution ratio when the compressed image is viewed and improve the user experience, the embodiment of the application provides an image compression method and an image decompression method. The image compression and decompression method can be applied to any electronic equipment such as mobile phones, computers, notebooks and the like.
In the image compression and decompression method provided by the embodiment of the application, a CNN model is obtained by training a plurality of images lower than a resolution threshold and a plurality of images higher than the resolution threshold. And compressing the image by adopting a CNN model to obtain network compressed data with lower resolution so as to reduce the occupied storage space. And then, decompressing the network compressed data by using the CNN model to obtain a decompressed image. Because the CNN is obtained by training a plurality of images lower than the resolution threshold and a plurality of images higher than the resolution threshold, a decompressed image with a higher resolution can be obtained by using the CNN model, and even the resolution of the decompressed image is higher than that of the original image. This effectively reduces the loss of resolution when viewing the compressed image and improves the user experience.
The present application will be described in detail below with reference to specific examples.
Referring to fig. 1, fig. 1 is a schematic flowchart of a first method for compressing an image according to an embodiment of the present application, where the method includes the following steps.
Step 101, obtaining an image to be compressed.
When the image needs to be compressed, the image is acquired as an image to be compressed.
In the embodiment of the present application, the image to be compressed may be an independent image or an image located in a document. The documents include but are not limited to PDF documents, Word documents, Excel documents. The PDF document may be an editable PDF document.
And 102, compressing the image to be compressed by using the CNN model to obtain network compressed data.
The CNN model is obtained by training a preset training set, wherein the training set comprises a plurality of low-resolution images with the resolution lower than a resolution threshold value and images with the resolution higher than the resolution threshold value corresponding to the low-resolution images.
In one embodiment of the present application, the training process of the CNN model shown in fig. 2 includes the following steps.
And step 21, acquiring a preset CNN model. Initializing parameters in the CNN model, wherein the initialized parameters can be set according to actual needs and experience.
In this step, high-level parameters related to training, such as learning rate and gradient descent algorithm, may also be set reasonably, and various manners in the related art may be specifically adopted, which are not described in detail herein.
And step 22, presetting a training set. The training set comprises a plurality of low-resolution images with the resolution lower than a resolution threshold value, and high-resolution images with the resolution higher than the resolution threshold value corresponding to the low-resolution images.
And step 23, extracting image data of a plurality of low-resolution images.
Step 24, performing forward calculation, specifically including: and respectively inputting each high-resolution image in the training set into a preset CNN model for convolution filtering compression processing to obtain network compression data.
And step 25, determining a loss value of the compressed image based on the plurality of image data and the obtained network compressed data.
In the embodiment of the application, the similarity between the image data of the low-resolution image and the corresponding network compressed data can be calculated. The greater the similarity, the smaller the loss value of the compressed image. The smaller the similarity, the larger the loss value of the compressed image.
In the embodiment of the application, a Mean Squared Error (MSE) formula may also be used as the loss function to obtain the loss value of the compressed image. For details, reference may be made to descriptions of MSE in the related art, and details are not described here.
And step 26, determining whether the preset CNN model is converged or not based on the loss value of the compressed image. If not, go to step 27; and if the CNN model is converged, ending the CNN model training.
In one embodiment, a loss threshold may be preset. And if the loss value of the compressed image is lower than the loss threshold value, determining that the CNN model converges. And if the loss value of the compressed image is not lower than the loss threshold value, determining that the CNN model does not converge.
And 27, adjusting parameters in the preset CNN model, and returning to the step 24.
The electronic device for CNN model training and the electronic device for image compression may be the same device or different devices.
And step 103, storing the network compressed data.
In the embodiment of the application, if the image to be compressed is an independent image, the obtained network compressed data is directly stored after the network compressed data is obtained. And if the image to be compressed is an image in the document, storing the obtained network compressed data in the document after the network compressed data is obtained. For example, the image 1 to be compressed is located in the PDF document f1, and after the network compression data 1 of the image 1 to be compressed is obtained, the network compression data 1 is stored in the PDF document f 1.
In the embodiment of the application, the network compression data obtained by adopting the CNN model compression is not an image, and the image cannot be directly opened by adopting image processing software to obtain the image. For easy viewing, referring to fig. 3, fig. 3 is a schematic flow chart of an image compression method provided in the embodiment of the present application, and based on fig. 1, the method includes the following steps.
Step 301, acquiring an image to be compressed.
Step 301 is the same as step 101.
And 302, compressing the image to be compressed by using the CNN model to obtain network compressed data. The CNN model is obtained by training a preset training set, wherein the training set comprises a plurality of low-resolution images with the resolution lower than a resolution threshold value and images with the resolution higher than the resolution threshold value corresponding to the low-resolution images.
Step 302 is the same as step 102.
And 303, performing size compression on the image to be compressed to obtain a size compressed image.
For example, an image of 100 × 100 pixels is size-compressed, resulting in an image of 50 × 50 pixels. The image of 50 x 50 pixels is the size-compressed image.
And step 304, storing the network compressed data, and storing the relation between the size compressed image and the preset identifier. The preset identification is used for indicating that network compressed data of the image to be compressed exist.
In the embodiment of the application, after the size compressed image is obtained, the size compressed image may be stored first, and after the network compressed data is obtained, the preset identifier corresponding to the size compressed image may be stored. Or the network compressed data can be obtained first, and the relation between the size compressed image and the preset identifier can be directly stored after the size compressed image is obtained. This is not limited in the embodiments of the present application.
In the embodiment of the application, the network compressed data is stored, the size compressed image is also stored, and if the user cannot open the image through the network compressed data, the size compressed image can be opened, so that the problem that the user cannot view the image is solved.
Based on the above image compression method embodiment, the embodiment of the present application further provides an image decompression method. Referring to fig. 4, fig. 4 is a first flowchart illustrating an image decompression method according to an embodiment of the present application, where the method includes the following steps.
Step 401, network compressed data of the target image is obtained.
In the embodiment of the application, the target image is an image which needs to be opened by a user. The target image may be a separate image or an image located in a document. The documents include but are not limited to PDF documents, Word documents, Excel documents.
If a user needs to open a document, the images in the document can be used as target images.
Step 402, decompressing the network compressed data by using the CNN model to obtain a decompressed image.
The CNN model is obtained by training a preset training set, wherein the training set comprises a plurality of low-resolution images with the resolution lower than a resolution threshold value and images with the resolution higher than the resolution threshold value corresponding to the low-resolution images.
In one embodiment of the present application, the training for the decompressed CNN model may refer to the training flow for the compressed CNN model shown in fig. 2. The training procedure for the decompressed CNN model differs from the training procedure for the compressed CNN model in that: extracting image data of a plurality of high-resolution images, respectively inputting each low-resolution image in a training set into a preset CNN model for convolution filtering decompression processing to obtain a decompressed image, and determining a loss value of the decompressed image based on the plurality of image data and the obtained decompressed image.
The electronic device for CNN model training and the electronic device for decompressing images may be the same device or different devices.
Step 403, outputting the decompressed image.
In the embodiment of the application, the CNN model is obtained by training a plurality of images lower than the resolution threshold and a plurality of images higher than the resolution threshold, so that the CNN model is more suitable for obtaining network compressed data as images, obtaining decompressed images with higher resolution, and even obtaining decompressed images with resolution higher than that of the original images. This effectively reduces the loss of resolution when viewing the compressed image and improves the user experience.
In the embodiment of the application, the network compression data is not an image, and the image cannot be directly opened by adopting image processing software. For convenience of viewing, referring to fig. 5, fig. 5 is a schematic flowchart of a second image decompression method provided in an embodiment of the present application, and based on fig. 4, the method includes the following steps.
Step 501, obtaining a size compressed image of a target image.
Step 502, judging whether a preset identifier corresponding to the size compressed image is stored. If so, go to step 503. If not, go to step 506. The preset identification is used for indicating that the network compressed data of the target image exists.
In the embodiment of the application, if the preset identifier corresponding to the size compressed image is stored, the network compressed data of the target image is determined to exist. And if the preset identification corresponding to the size compressed image is not stored, determining that the network compressed data of the target image does not exist.
Step 503, obtaining the network compressed data.
Step 504, decompressing the network compressed data by using the CNN model to obtain a decompressed image.
Step 505, outputting the decompressed image.
Steps 503-505 are the same as steps 401-403.
Step 506, outputting the size compressed image.
In an embodiment of the present application, if a decompressed image cannot be obtained, for example, a decompressed image cannot be obtained because no CNN model exists, the size-compressed image is directly output to ensure that a user views the image.
Based on the above image compression method embodiment, the embodiment of the present application further provides an image compression apparatus. Referring to fig. 6, fig. 6 is a schematic diagram of a first structure of an image compression apparatus according to an embodiment of the present application, where the apparatus includes the following modules.
An obtaining module 601, configured to obtain an image to be compressed;
a first compression module 602, configured to compress an image to be compressed by using a CNN model, so as to obtain network compressed data; the CNN model is obtained by training a preset training set, wherein the training set comprises a plurality of low-resolution images with the resolution lower than a resolution threshold value and images with the resolution higher than the resolution threshold value corresponding to the low-resolution images;
a first storage module 603, configured to store the network compressed data.
In an embodiment of the present application, the image compression apparatus shown with reference to fig. 7 may further include, based on fig. 6:
a second compression module 604, configured to perform size compression on the image to be compressed after the image to be compressed is acquired, so as to obtain a size-compressed image;
a second storage module 605, configured to store a relationship between the size compressed image and the preset identifier after obtaining the network compressed data; the preset identifier is used for indicating that network compressed data of the image to be compressed exists.
In one embodiment of the application, the image to be compressed is located in a PDF document; or
The image to be compressed is positioned in the Word document; or
The image to be compressed is located in an Excel document.
The embodiment of the application provides an image compression method, which utilizes training of a plurality of images lower than a resolution threshold value and a plurality of images higher than the resolution threshold value to obtain a CNN model. And compressing the image by adopting a CNN model to obtain network compressed data with lower resolution so as to reduce the occupied storage space. And then, decompressing the network compressed data by using the CNN model to obtain a decompressed image. Because the CNN is obtained by training a plurality of images lower than the resolution threshold and a plurality of images higher than the resolution threshold, a decompressed image with a higher resolution can be obtained by using the CNN model, and even the resolution of the decompressed image is higher than that of the original image. This effectively reduces the loss of resolution when viewing the compressed image and improves the user experience.
Based on the above image decompression method embodiment, the present application also provides an image decompression apparatus. Referring to fig. 8, fig. 8 is a schematic diagram of a first structure of an image decompression apparatus according to an embodiment of the present application, where the apparatus includes the following modules.
An obtaining module 801, configured to obtain network compressed data of a target image;
a decompression module 802, configured to decompress the network compressed data by using the CNN model to obtain a decompressed image; the CNN model is obtained by training a preset training set, wherein the training set comprises a plurality of low-resolution images with the resolution lower than a resolution threshold value and images with the resolution higher than the resolution threshold value corresponding to the low-resolution images;
an output module 803, configured to output the decompressed image.
In an embodiment of the present application, the obtaining module 801 may be specifically configured to obtain a size-compressed image of a target image; judging whether a preset identifier corresponding to the size compressed image is stored or not; the preset identification is used for indicating that network compressed data of the target image exists; and if the data is stored, acquiring the network compressed data.
In an embodiment of the present application, the output module 803 is further configured to output the size-compressed image if the preset identifier corresponding to the size-compressed image is not stored.
The embodiment of the application provides an image decompression method, which obtains a CNN model by training a plurality of images lower than a resolution threshold and a plurality of images higher than the resolution threshold. And compressing the image by adopting a CNN model to obtain network compressed data with lower resolution so as to reduce the occupied storage space. And then, decompressing the network compressed data by using the CNN model to obtain a decompressed image. Because the CNN is obtained by training a plurality of images lower than the resolution threshold and a plurality of images higher than the resolution threshold, a decompressed image with a higher resolution can be obtained by using the CNN model, and even the resolution of the decompressed image is higher than that of the original image. This effectively reduces the loss of resolution when viewing the compressed image and improves the user experience.
Based on the above image compression method embodiment, an electronic device is further provided in the embodiments of the present application, as shown in fig. 9, and includes a processor 901, a communication interface 902, a memory 903, and a communication bus 904, where the processor 901, the communication interface 902, and the memory 903 complete mutual communication through the communication bus 904,
a memory 903 for storing computer programs;
the processor 901 is configured to implement the image compression method described above when executing a program stored in the memory 903. The image compression method comprises the following steps:
acquiring an image to be compressed;
compressing an image to be compressed by using a CNN model to obtain network compressed data; the CNN model is obtained by training a preset training set, wherein the training set comprises a plurality of low-resolution images with the resolution lower than a resolution threshold value and images with the resolution higher than the resolution threshold value corresponding to the low-resolution images;
and storing the network compressed data.
The embodiment of the application provides an image compression method, which utilizes training of a plurality of images lower than a resolution threshold value and a plurality of images higher than the resolution threshold value to obtain a CNN model. And compressing the image by adopting a CNN model to obtain network compressed data with lower resolution so as to reduce the occupied storage space. And then, decompressing the network compressed data by using the CNN model to obtain a decompressed image. Because the CNN is obtained by training a plurality of images lower than the resolution threshold and a plurality of images higher than the resolution threshold, a decompressed image with a higher resolution can be obtained by using the CNN model, and even the resolution of the decompressed image is higher than that of the original image. This effectively reduces the loss of resolution when viewing the compressed image and improves the user experience.
Based on the above-mentioned image decompression method embodiment, the present application further provides an electronic device, as shown in fig. 10, including a processor 1001, a communication interface 1002, a memory 1003 and a communication bus 1004, wherein the processor 1001, the communication interface 1002 and the memory 1003 complete mutual communication via the communication bus 1004,
a memory 1003 for storing a computer program;
the processor 1001 is configured to implement the image decompression method described above when executing the program stored in the memory 1003. The image decompression method comprises the following steps:
acquiring network compressed data of a target image;
decompressing the network compressed data by using the CNN model to obtain a decompressed image; the CNN model is obtained by training a preset training set, wherein the training set comprises a plurality of low-resolution images with the resolution lower than a resolution threshold value and images with the resolution higher than the resolution threshold value corresponding to the low-resolution images;
the decompressed image is output.
The embodiment of the application provides an image decompression method, which obtains a CNN model by training a plurality of images lower than a resolution threshold and a plurality of images higher than the resolution threshold. And compressing the image by adopting a CNN model to obtain network compressed data with lower resolution so as to reduce the occupied storage space. And then, decompressing the network compressed data by using the CNN model to obtain a decompressed image. Because the CNN is obtained by training a plurality of images lower than the resolution threshold and a plurality of images higher than the resolution threshold, a decompressed image with a higher resolution can be obtained by using the CNN model, and even the resolution of the decompressed image is higher than that of the original image. This effectively reduces the loss of resolution when viewing the compressed image and improves the user experience.
The communication bus may be a PCI (Peripheral Component Interconnect) bus, an EISA (Extended Industry Standard Architecture) bus, or the like. The communication bus may be divided into an address bus, a data bus, a control bus, etc. A
The communication interface is used for communication between the electronic equipment and other equipment.
The Memory may include a RAM (Random Access Memory) or an NVM (Non-Volatile Memory), such as at least one disk Memory. Optionally, the memory may also be at least one memory device located remotely from the processor.
The Processor may be a general-purpose Processor, including a Central Processing Unit (CPU), a Network Processor (NP), and the like; but also DSPs (Digital Signal Processing), ASICs (Application Specific Integrated circuits), FPGAs (Field Programmable Gate arrays) or other Programmable logic devices, discrete Gate or transistor logic devices, discrete hardware components.
Based on the above image compression method embodiment, an embodiment of the present application further provides a machine-readable storage medium, in which a computer program is stored, and when the computer program is executed by a processor, the computer program implements any of the above image compression methods.
Based on the above image decompression method embodiment, an embodiment of the present application further provides a machine-readable storage medium, in which a computer program is stored, and when the computer program is executed by a processor, the computer program implements any of the above image decompression methods.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
All the embodiments in the present specification are described in a related manner, and the same and similar parts among the embodiments may be referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, as for the embodiments of the image compression apparatus, the image decompression apparatus, the electronic device, and the machine-readable storage medium, since they are substantially similar to the embodiments of the image compression method and the image decompression method, the description is relatively simple, and the relevant points can be referred to the partial description of the embodiments of the image compression method and the image decompression method.
The above description is only for the preferred embodiment of the present application, and is not intended to limit the scope of the present application. Any modification, equivalent replacement, improvement and the like made within the spirit and principle of the present application are included in the protection scope of the present application.

Claims (16)

1. A method of image compression, the method comprising:
acquiring an image to be compressed;
compressing the image to be compressed by utilizing a convolutional neural network model to obtain network compressed data; the convolutional neural network model is obtained by utilizing a preset training set in a training mode, wherein the training set comprises a plurality of low-resolution images with the resolution lower than a resolution threshold value and images with the resolution higher than the resolution threshold value corresponding to the low-resolution images;
and storing the network compressed data.
2. The method of claim 1, further comprising:
after the image to be compressed is obtained, carrying out size compression on the image to be compressed to obtain a size compressed image;
after the network compressed data is obtained, storing the relation between the size compressed image and a preset identifier; the preset identification is used for indicating that the network compressed data of the image to be compressed exists.
3. The method according to claim 1 or 2, wherein the image to be compressed is located in a PDF document; or the image to be compressed is positioned in the Word document; or the image to be compressed is positioned in an Excel document.
4. A method of image decompression, the method comprising:
acquiring network compressed data of a target image;
decompressing the network compressed data by using a convolutional neural network model to obtain a decompressed image; the convolutional neural network model is obtained by utilizing a preset training set in a training mode, wherein the training set comprises a plurality of low-resolution images with the resolution lower than a resolution threshold value and images with the resolution higher than the resolution threshold value corresponding to the low-resolution images;
outputting the decompressed image.
5. The method of claim 4, wherein the step of obtaining network compressed data of the target image comprises:
acquiring a size compressed image of a target image;
judging whether a preset identification corresponding to the size compressed image is stored or not; the preset identification is used for indicating that network compressed data of the target image exist;
and if the network compressed data is stored, acquiring the network compressed data.
6. The method of claim 5, further comprising:
and if the preset identification corresponding to the size compressed image is not stored, outputting the size compressed image.
7. An image compression apparatus, characterized in that the apparatus comprises:
the acquisition module is used for acquiring an image to be compressed;
the first compression module is used for compressing the image to be compressed by utilizing a convolutional neural network model to obtain network compression data; the convolutional neural network model is obtained by utilizing a preset training set in a training mode, wherein the training set comprises a plurality of low-resolution images with the resolution lower than a resolution threshold value and images with the resolution higher than the resolution threshold value corresponding to the low-resolution images;
and the first storage module is used for storing the network compressed data.
8. The apparatus of claim 7, further comprising:
the second compression module is used for carrying out size compression on the image to be compressed after the image to be compressed is obtained, so as to obtain a size compressed image;
the second storage module is used for storing the relation between the size compressed image and a preset identifier after the network compressed data is obtained; the preset identification is used for indicating that the network compressed data of the image to be compressed exists.
9. The apparatus method according to claim 7 or 8, wherein the image to be compressed is located in a PDF document; or the image to be compressed is positioned in the Word document; or the image to be compressed is positioned in an Excel document.
10. An image decompression apparatus, characterized in that the apparatus comprises:
the acquisition module is used for acquiring network compressed data of the target image;
the decompression module is used for decompressing the network compressed data by utilizing the convolutional neural network model to obtain a decompressed image; the convolutional neural network model is obtained by utilizing a preset training set in a training mode, wherein the training set comprises a plurality of low-resolution images with the resolution lower than a resolution threshold value and images with the resolution higher than the resolution threshold value corresponding to the low-resolution images;
an output module for outputting the decompressed image.
11. The apparatus according to claim 10, wherein the obtaining module is specifically configured to obtain a size-compressed image of the target image; judging whether a preset identification corresponding to the size compressed image is stored or not; the preset identification is used for indicating that network compressed data of the target image exist; and if the network compressed data is stored, acquiring the network compressed data.
12. The apparatus of claim 11, wherein the output module is further configured to output the size-compressed image if the preset identifier corresponding to the size-compressed image is not stored.
13. An electronic device, comprising a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory complete communication with each other through the communication bus;
the memory is used for storing a computer program;
the processor, configured to execute the program stored in the memory, implements the method steps of any of claims 1-3.
14. An electronic device, comprising a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory complete communication with each other through the communication bus;
the memory is used for storing a computer program;
the processor, configured to execute the program stored in the memory, implements the method steps of any of claims 4-6.
15. A readable storage medium, characterized in that a computer program is stored in the readable storage medium, which computer program, when being executed by a processor, carries out the method steps of any one of claims 1-3.
16. A readable storage medium, characterized in that a computer program is stored in the readable storage medium, which computer program, when being executed by a processor, carries out the method steps of any one of claims 4-6.
CN201811095462.0A 2018-09-19 2018-09-19 Image compression method, image decompression method, image compression device, image decompression device, electronic equipment and storage medium Pending CN110933432A (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201811095462.0A CN110933432A (en) 2018-09-19 2018-09-19 Image compression method, image decompression method, image compression device, image decompression device, electronic equipment and storage medium
PCT/CN2019/106149 WO2020057492A1 (en) 2018-09-19 2019-09-17 Image compression and decompression method and apparatus, electronic device, and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811095462.0A CN110933432A (en) 2018-09-19 2018-09-19 Image compression method, image decompression method, image compression device, image decompression device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN110933432A true CN110933432A (en) 2020-03-27

Family

ID=69855970

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811095462.0A Pending CN110933432A (en) 2018-09-19 2018-09-19 Image compression method, image decompression method, image compression device, image decompression device, electronic equipment and storage medium

Country Status (2)

Country Link
CN (1) CN110933432A (en)
WO (1) WO2020057492A1 (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104284187A (en) * 2013-07-12 2015-01-14 英特尔公司 Techniques for inclusion of thumbnail images in compressed video data
CN105611303A (en) * 2016-03-07 2016-05-25 京东方科技集团股份有限公司 Image compression system, decompression system, training method and device, and display device
CN107547773A (en) * 2017-07-26 2018-01-05 新华三技术有限公司 A kind of image processing method, device and equipment
CN107563965A (en) * 2017-09-04 2018-01-09 四川大学 Jpeg compressed image super resolution ratio reconstruction method based on convolutional neural networks
CN108012157A (en) * 2017-11-27 2018-05-08 上海交通大学 Construction method for the convolutional neural networks of Video coding fractional pixel interpolation
CN108062780A (en) * 2017-12-29 2018-05-22 百度在线网络技术(北京)有限公司 Method for compressing image and device

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20180131946A1 (en) * 2016-11-07 2018-05-10 Electronics And Telecommunications Research Institute Convolution neural network system and method for compressing synapse data of convolution neural network
JP2018132855A (en) * 2017-02-14 2018-08-23 国立大学法人電気通信大学 Image style conversion apparatus, image style conversion method and image style conversion program
CN107018422B (en) * 2017-04-27 2019-11-05 四川大学 Still image compression method based on depth convolutional neural networks
CN107155110A (en) * 2017-06-14 2017-09-12 福建帝视信息科技有限公司 A kind of picture compression method based on super-resolution technique
CN107481295B (en) * 2017-08-14 2020-06-30 哈尔滨工业大学 Image compression system of convolutional neural network based on dynamic byte length distribution
CN107578377A (en) * 2017-08-31 2018-01-12 北京飞搜科技有限公司 A kind of super-resolution image reconstruction method and system based on deep learning

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104284187A (en) * 2013-07-12 2015-01-14 英特尔公司 Techniques for inclusion of thumbnail images in compressed video data
CN105611303A (en) * 2016-03-07 2016-05-25 京东方科技集团股份有限公司 Image compression system, decompression system, training method and device, and display device
CN107547773A (en) * 2017-07-26 2018-01-05 新华三技术有限公司 A kind of image processing method, device and equipment
CN107563965A (en) * 2017-09-04 2018-01-09 四川大学 Jpeg compressed image super resolution ratio reconstruction method based on convolutional neural networks
CN108012157A (en) * 2017-11-27 2018-05-08 上海交通大学 Construction method for the convolutional neural networks of Video coding fractional pixel interpolation
CN108062780A (en) * 2017-12-29 2018-05-22 百度在线网络技术(北京)有限公司 Method for compressing image and device

Also Published As

Publication number Publication date
WO2020057492A1 (en) 2020-03-26

Similar Documents

Publication Publication Date Title
CN108681743B (en) Image object recognition method and device and storage medium
CN111080528B (en) Image super-resolution and model training method and device, electronic equipment and medium
CN108022212B (en) High-resolution picture generation method, generation device and storage medium
US20180268571A1 (en) Image compression device
US20200320352A1 (en) Method and device for recognizing image and storage medium
CN111145202B (en) Model generation method, image processing method, device, equipment and storage medium
CN107547773B (en) Image processing method, device and equipment
CN111353514A (en) Model training method, image recognition method, device and terminal equipment
CN114071141A (en) Image processing method and equipment
CN115983365A (en) Model training method and device, computer equipment and storage medium
CN113837965A (en) Image definition recognition method and device, electronic equipment and storage medium
CN111709338B (en) Method and device for table detection and training method of detection model
CN110933432A (en) Image compression method, image decompression method, image compression device, image decompression device, electronic equipment and storage medium
CN114239760B (en) Multi-modal model training and image recognition method and device, and electronic equipment
CN112995673A (en) Sample image processing method and device, electronic equipment and medium
CN116468525A (en) Information processing method, information processing device, electronic equipment and computer storage medium
CN116229203A (en) Image processing method, training method, device, system and medium for model
CN112241740B (en) Feature extraction method and device
US8417751B1 (en) Signal processing by ordinal convolution
CN108519962B (en) Font display method and apparatus applied to android system, and terminal device
CN112581363A (en) Image super-resolution reconstruction method and device, electronic equipment and storage medium
CN113157987A (en) Data preprocessing method for machine learning algorithm and related equipment
CN110930333A (en) Image restoration method and device, electronic equipment and computer-readable storage medium
CN110929767A (en) Font processing method, system, device and medium
CN110930302B (en) Picture processing method and device, electronic equipment and readable storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20200327