You are on page 1of 12

i

BANNARI

AMMAN

INSTITUTE

OF

TECHNOLOGY
(AFFLIATED TO ANNA UNIVERSITY)

SATHYAMANGALAM
IMAGE COMPRESSION AND DECOMPRESSION IN NEURAL NETWORKS

BY

Lavanya.K Keerthivarsha.G Pre-final Year Computer Science & Engineering lavancse@yahoo.co.in keerthicse.09@gmail.com

Contact Address: K.Lavanya Room no. 123,

ii

Ganga Hostel, BIT. SYNOPSIS


INTRODUCTION STATE OF ART DATA REDUNDANCIES
CODING REDUNDANCY INTERPIXEL REDUNDANCY PSYCHOVISUAL REDUNDANCY

METHODOLOGY MATHEMATICAL DEFINITION COUNTER PROPAGATION NN ALGORITHM COMPRESSION DECOMPRESSION PROCEDURE


DYNAMIC CLUSTERING PROCESS WEIGHT ASSIGNMENT WINNING NEURON

REPRESENTATIVE COLOR SELECTION COMPRESSION PROCESS


STRUCTURE

DECOMPRESSION PROCESS QUALITY MEASUREMENT FUTURE EXTENSION CONCLUSION

iii

INTRODUCTION
There is a need for digital color images to be stored in all the applications. Especially, in medical and satellite communications, very large images are transferred from one place to another place. They are unsuitable to be transferred over slow communication line. The purpose of the image compression is to represent images with less data in order to save storage costs or transmission time or costs. Some neural network image compression techniques are already found but the training time required for these algorithms are much more. So a new method by clustering the vectors onto limited number of clusters based on compression requirement is proposed in this paper and the general block diagram is shown. In the counter propagation network, the middle layer is organized dynamically to form number of clusters based on the number of colors used in the image, size of the image and also on the compression requirement. CPN With dynamic Compressed clustering file technique

Source Image

Input Pixels

Decompression Process

Retrieved file or Decompressed Image file

Image Compression and Decompression Block

STATE OF ART
Image compression addresses the problem of reducing the amount of data required to represent a digital image. The underlying basis of the reduction process is removal of redundant data.Image compression plays a crucial role in many important and diverse applications, including televideo-conferencing, remote sensing, document,

iv medical imaging, facsimile transmission, control of remotely piloted vehicles in military, space, hazardous waste control applications and multimedia computing. Compression techniques fall into two broad categories : 1. Information preserving, this category is useful in image archiving. These methods allow an image to be compressed and decompressed without losing information. Examples: Variable length coding (Huffman coding) 2. Lossy compression provides higher levels of data reduction but result in a less than perfect reproduction of the original image. Examples: Lossy predictive coding

DATA REDUNDANCIES
Data redundancy is a central issue in digital image compression .If n1 and n2 denote the number of information carrying units in two data sets that represent the same information, the relative data redundancy RD of the first data set (the one characterized by n1) can be defined as RD= 1-(1/Cn) Where Cn, commonly called the compression ratio, is Cn=n1/n2 The three basic data redundancies in digital image compression are: Coding redundancy Interpixel redundancy Psycho visual redundancy If the gray levels of an image uses more code symbols to represent each gray level, the resulting image is said to contain coding redundancy. The value of any pixel can be predicted from the value of its neighbours, the information carried by individual pixels is relatively small. This is said to have inter pixel redundancy. Certain information has less relative importance than other information in normal visual processing. This information is said to be psychovisually redundant. Such redundancies can be removed from the source image file and hence a compressed file can be obtained.

METHODOLOGY
In a truly uncompressed file (BMP file), the color information of an image is stored pixel by pixel and their position in images is irrelevant because they are

v stored in a pre determined order. The color information of a pixel is basically defined by its three color quantities: red, green and blue quantity. By varying the contents of these three quantities various pixels are formed. quantity .Now 24 bits for a particular means there are 2 power 24(16 million) possible colors. During compression only lesser number of bits as much as possible should be allowed to make compression process effective. The problem is, if only lesser number of bits per pixel is allowed during compression, then it is not possible to allow such huge number of colors like 16 million. In that case the total color requirement should be reduced and thus there will be some loss in the color information. Images can always tolerate some amount of noises if they can be organized in a very tactful manner. So there is a need to reduce total number of colors of an image to achieve compression effectively, one way to achieve this objective is to group those pixels together, which are exactly same or very close to each other with respect to their color information. The bitmap file (.bmp) consists of the header information, the color information of the image. The 24-bit bitmap image [.bmp] illustrated below. Bitmap header 54 bytes
24 bit Bitmap file format details.

PIXEL

arrangement R2

is

B1 G1 Pixel 1

R1

B2 G2 Pixel--2

MATHEMATICAL DEFINITION OF SIMILAR PIXELS


Now if the three color quantities are interpreted as three individual dimensions on a three-dimensional space then each pixel may be viewed as a vector lying on a three-dimensional space.

(a)

(b) Clustering of pixels based on their vectors

(c)

Now let us consider about two pixels defined by their color content. If they are mapped on a three-dimensional space as shown in Fig (a) then they will constitute two

vi separate vectors having an angle in between them. As for example let us consider three pixels p1, p2, p3 which are mapped onto three individual vectors V1, V2, V3 respectively as shown in Fig 2.2 (b). Now, let 1 > 2. Then obviously the vector V2 is much closer to the vector V3 then to the vector V1. So pixel p2 will be much similar to the pixel p3 than to the pixel p1 with respect to their color content. In this way each and every pixel of an image can be mapped easily on a three-dimensional space and the similarities between them are found . The pixels will be grouped together based on their similarities and number of groups will depend on the required compression level. This phenomenon has been shown pictorially in Fig (c). The ultimate quality of the image will basically depend upon the total number of groups. If more number of groups is allowed, the picture quality will be improved but the space requirement will be increased. So there is a trade-off between total number of groups and total space requirement.

MODIFIED COUNTER PROPAGATION NEURAL NETWORK ALGORITHM


The network used here is Counter Propagation Network which is very popular because of its simplicity in calculation and strong power of generalization. The main advantage of this network is that it takes less time for training purpose . The different layers in the network are given as follows: Input Layer Middle Layer (Kohenen Layer) Final Layer (Grossberg Layer)

Input Pixels

R G B

Desired output

various layers of modified counter propagation network.

vii In the standard counter propagation network the middle layer has a fixed number of neurons whereas in the proposed approach the middle layer neurons are dynamically organized. The Middle layer in the standard counter propagation networks is usually having fixed number of neurons depending on the compression ratio requirement. In order to compromise the compression ratio and quality of the image, an optimum number of neurons to be selectedThe number of neurons organized dynamically depends on the error limit selected. The three neurons in the input layer represent the input of R, G, and B colors of a pixel. Each neuron in the middle layer has connecting weights for each neuron of the previous layer. It should be trained in unsupervised mode such that they can distinguish the similar pixels from the dissimilar pixels. The neurons in the final layer are responsible for the reproduction of the color information of pixels.

COMPRESSION-DECOMPRESSION PROCEDURE
The four major steps are: 1. Clustering all the pixels into predetermined number of groups. 2. Producing a representative color for each group. 3. For each pixel storing only the cluster number during compression. 4. During decompression restoring the cluster number and storing the representative color of that cluster.

DYNAMIC CLUSTERING PROCESS


For clustering purpose, neural network is used and it is found that counter propagation network is best suited. Counter propagation network are very popular because of its simplicity in calculations and strong power of generalization. The counter propagation network

viii

The number of neurons in the kohonen layer will vary based on the total number of clusters allowed. If 1024 clusters are allowed then there are exactly 1024 neurons. One of the major disadvantages in conventional Counter Propagation Network is that this middle layer cluster size is fixed and hence the compressed file should contain all the representative colors for these neurons which will increase the size of the compressed file. Instead of this, a new technique of dynamic clustering is introduced here in which the middle layer neurons are allotted depending upon the number of colors used and the size of the original source image. Each of the neuron in the middle layer has connecting weights for each of the neuron of the previous layer.

WEIGHT ASSIGNMENT (INPUT LAYER & KOHONEN LAYER)


weight assignment

The Random weights are assigned between Input Layers to Kohonen Layer and they are kept constant. These weights are responsible to distinguish the similar pixels and the dissimilar pixels.

WINNING NEURON
After assigning weight and the net value for each neuron in Kohonen layer will be found using the following formula Netj=W1jX1+W2jX2+W3jX3 (1)

The neuron having high net value is declared as the winning neuron for the current pixel.

ix When the pixel having the similar type of color information is applied to the input layer, the same neuron in the middle layer is going to fire. In this way the clustering process will be fully automated.

REPRESENTATIVE COLOR SELECTION


After processing all the pixels to form clusters, the next step is to select a representative value for each cluster or group. The representative for a particular cluster is the average of all the colors within the cluster. The weight between that winning neuron of the current pixel and the final layer is adjusted. The equation for weight adjustment is as follows: Vij (new) = Vij (old) + (Yj Vij (old)) Where, Vij (new) New weight between middle (i) and final (j) layer neuron Vij (old) Old weight between middle (i)and final (j) layer neuron a scalar quantity which varies between 0.1 to 0.25 Yj the jth component of the input vector In equation 2 the amount of the weight adjustment is proportional to the difference between the weight and the desired output of the grossberg neuron to which it connects. The similar pixels will fire the same kohonen neuron and the weights connected to that firing neuron will be adjusted . Thus it will help the convergence process of the weights between the last two layers (2)

COMPRESSION PROCESS
After finding the winning neuron and getting the representative pixel, the next step is to compress the file.

STRUCTURE OF COMPRESSED FILE


54 byte bitmap header Index of the winning neuron for each pixel Representative color for each winning neuron

DECOMPRESSION PROCESS
Accept the compressed file and produce the uncompressed bitmap file.

COMPRESSION PROCESS OVERVIEW


The main objective of the compression process is to group the similar pixels and to choose a representative color for those pixels. Tasks involved are

x Get the source image file Read the header information Read the pixel values and find its winning neuron in the middle layer Train the network to produce a representative color

CONVERGENCE PROCESS
Each neuron in the middle layer contains a group of similar pixels. Now the network should be trained in order to get a representative color for those pixels. The equation for weight adjustment is given as Vij (new) = Vij (old) + (Yj Vij (old)) SAMPLE CODE The following code specifies the convergence process: weight2[i][0] = (weight2[i][0]+(np*(start[i]->R-weight2[i][0]))); weight2[i][1] = (weight2[i][1]+(np*(start[i]->G-weight2[i][1]))); weight2[i][2] = (weight2[i][2]+(np*(start[i]->B-weight2[i][2]))); np = np+(0.15/(height*width));

DECOMPRESSION PROCESS OVERVIEW


The 54-byte header is directly copied to the decompressed image file from the compressed file. Its header information such as height, width are also read and stored in separate variables. After reading the header information, the winning neuron index is read from the compressed file and is stored in an array, representative color information for winning neurons are read from the compressed file. Then the representative colors are replaced for those winning neuron in the decompressed file. Thus the decompressed image is obtained.

QUALITY MEASUREMENT
Actual quality of the retrieved image is measured using PSNR (Peak-signal-to-NoiseRatio).The PSNR ratio is calculated in three-color quantities using PSNR (color) = 10 log 10 (2552 / MSE (color)) dB And Where X jk MSE (color) = 1/N E j=1N (x jk y jk) 2 Color = red, blue, green

= corresponding color components quantity of the original pixel

xi Y jk = corresponding color components quantity of the pixel after compression

and decompression procedure.The final PSNR value is calculated as: PSNR = (PSNR (red) + PSNR (green) + PSNR (blue)) / 3

PSNR RATIO VS COMPRESSION RATIO


The PSNR ratio decreases with the increase in Compression ratio and the PSNR curve shown for the standard images are

PSNR Vs

Compression Ratio

FUTURE EXTENSION
This work may be extended in several ways. The whole image may be subdivided into small part of sub-images and then the algorithm might be applied to evaluate performance. Also the correlation between sub-images may be easily exploited to achieve further compression. A hierarchical counter propagation network might also be employed to get some effective results. This approach is also extended with fuzzy concepts in the input layer and in the middle layer to handle fuzzified quantitieS

CONCLUSION
A modified counter propagation network with dynamically organized kohenen layer and a suitable training algorithm are implemented in this paper The experimental results show that the proposed approach gives higher

xii compression ratio with very less time consumption and better quality decompressed images than the conventional counter propagation network.

REFERENCE
MASTERS,TIMOTHY(1994) Signal and image processing with Neural Networks. GURNEY,K.(1997) An introduction to Neural Networks. BISHOP,C.M.(1995).Neural Networks for pattern recognition.

You might also like