THE APPLICATION OF FUZZY LOGIC TO JPEG

C. J. Wu and A.H. Sung

Department of Computer Science

New Mexico Tech.

Socorro, NM 87801

C.J. Wu and A.H. Sung, "The Application of Fuzzy Logic to JPEG," IEEE Trans. Consumer Electronics, vol. 40, no. 4, pp. 976-984, 1994.

ABSTRACT

To achieve the efficiency and automatic control, a fuzzy controller to incorporate with the JPEG lossy model is proposed in this work. The simulation results based on USC 15 pictures indicate that this JPEG model equipped with the designed fuzzy controller is insensitive to the given initial input values, that is, (with the help of fuzzy controller) this JPEG can always find the proper values of inputs for desired distortion ratio even though the relation of input parameters and the output distortion ratio is not known. In addition, the effect of different defuzzification techniques to accuracy and convergent speed is studied as well.

I. INTRODUCTION

The lossy JPEG model is one of the most widely used digital image compression techniques for both grayscale and color still images [1]. However, that compression results are not predictable in advance is the common problem shared by all lossy image data compression techniques because of the variety of image data. For a picture of MxN pixels with P grayscale levels, the possible combinations are up to , e.g., an image of 512x512 pixels with 256 grayscales can have combinations. With this kind of variety, it is nearly impossible for any lossy compression model to predicate the relation of its parameters and compression results, such as mean square error. Therefore, in a sense, the compression and distortion ratios depend heavily on the source image data. The following ratios are used in this work.

(1)

(2)

(3)

(4)

where and are the corresponding frames in the original and reconstructed pictures, respectively, N is the dimension of the input vector I (or frame M), F is the total number of frames, MAE is mean absolute error, and G is the maximum grayscale value of pictures.

What is the solution for this fundamental problem of image data compression? One commonly-used solution is to use trial-and-error searching for the better tradeoff between distortion and compression ratios. Apparently, this is not a feasible solution in modern society since it is so labor-intensive and time-consuming. Another common technique uses BPP as the index for picture quality as in [1]. However, the BPP is an index for compression ratio and has only an indirect relation with reconstructed picture quality. In addition, like the trial-and-error approach, the disadvantage of using indices is that human involvement is unavoidable because the actual result can vary significantly from image to image. Obviously, in order to achieve efficiency, the automatic control mechanism must be incorporated with the JPEG model.

The rest of paper is organized as follows. Section II describes the structure of designed fuzzy controller. The various experimental results are given in section III. Lastly, conclusions and discussions are given in section IV.

II. THE MECHANISM OF THE FUZZY CONTROLLER

Fuzzy logic was introduced by Zadeh in [2-3] and used by Mamdani and Assilian to control the dynamic system in [4-5]. Since then, fuzzy logic has been successfully applied to many applications for automatic control (especially for non-linear ill-defined systems) [6-15]. Thus, in this work, we propose a fuzzy controller to incorporate with the JPEG model to achieve the automatic control during compression process on source side. The relation of JPEG (including coder and decoder) and the fuzzy controller on source side is depicted in Figures 1 and 2. Since the image quality is our primary concern, we use AGE (defined in Eq. 4) as the index to guide the adjustment instead of BPP proposed in [1]. Though AGE (which is directly related to MAE) is not a perfect index for image quality, it is apparently better than BPP (which is the index of compression ratio) to indicate image quality.

Though the effect of fuzzy controller components (e.g., fuzzy sets, decision tables, and defuzzification equations) on overall performance of controller is not quite clear from mathematical points of view, the design of fuzzy controllers is well known for its simplicity as mentioned in [15].However, the unique challenge of this application is to design a controller to deal with a collection of monotone functions at the same time.



Fortunately, by taking advantage of the Monotone Function Property, convergence can be guaranteed by forcing the current feedback adjustment to be no larger than the previous adjustment except in the case of overshooting where .

The two inputs, and , to the fuzzy controller at the time t are defined as

(5)

(6)

The universal set of , E, is the interval of real numbers, while the universal set of , Q, is the interval of integer numbers. In general, the membership function of a fuzzy set A, , in the universal set X is defined as [16-17]

(7)

where is the interval of real numbers with 0 and 1 being the minimum and maximum membership values, respectively. In this paper, seven fuzzy sets are used--PB (positive big), PM (positive medium), PS (positive small), ZE (zero), NS (negative small), NM (negative medium), and NB (negative big)--for those inputs and the output of fuzzy controller.

For an input crisp value, the membership value of fuzzy set A is decided by

(8)

(9)

(10)

where C, L, and R are the central value, the left boundary, and the right boundary, respectively, and A={NM, NS, ZE, PS, PM}. For example, The following fuzzy sets of the form (L, C, R) for the input and the entries of decision tables are used in this work.

NB(-100, -50, -25), NM(-40, -25, -10), NS(-20, -10, 0), ZE(-5, 0, 5), PS(0, 10, 20), PM(10, 25, 40), PB(25, 50, 100)

For the input , the following fuzzy sets are used in this work.

NB(-100, -6, -3), NM(-5, -3, -1), NS(-2, -1, 0),

ZE(-0.5, 0, 0.5),

PS(0, 1, 2), PM(1, 3, 5), PB(3, 6, 100)

The decision table used by the fuzzy controller in this work is Table 1.


The value of decision table entry ij, , is calculated using the fuzzy-min operator

(11)

where is membership functions defined in Eqs. 8-10. As for the defuzzification, mean-of-inversions (MOI) for (the feedback from controller to JPEG) is calculated as

(MOI) (12)

where K and L are the number of rows and columns in the decision table, respectively. To guarantee that will not be larger than in terms of crisp value, is decided by the following algorithm:

Step 1. Calculate the corresponding crisp values T of fuzzy membership value .

(13)

where is the inverse function of and A is the corresponding fuzzy set of . Note that there might be more than one values generated by .

Step 2. Adjust each inverse value T for guaranteed convergence.

(14)

Step 3. Pick the largest absolute value . If , ; otherwise, .

In addition, will be smaller than in the case of overshooting.

III. SIMULATION RESULTS

Experiments were performed on 15 USC images which include eight 256x256 images and seven 512x512 images with 256 grayscales. The eight 256x256 pictures are Girl-I, Couple, Lady, Girl-II, House, Tree, Ball-I, and Ball-II. The seven 512x512 pictures are Splash, Girl-III, Baboon, Lena, F16, Park, and Pepper. The JPEG model is developed by Independent JPEG Group with the fuzzy controller created by the authors [18]. In addition, ten random initial values, 38, 58, 13, 15, 51, 27, 10, 19, 12, and 86, of q generated by C's rand() are used to test the accuracy of designed fuzzy controller. The following function is used to describe the behavior of JPEG

(15)

where g is the generated AGE, and q is the value of parameter Quality. To measure the performance of fuzzy controller, we define successful trials and unsuccessful trials as follows:

Definition 1. Successful Trials: We say the fuzzy controller succeeds at a trial if the following conditions are met:

(1) The final value is in the target range, that is, where T is the TGE and is the tolerance.

(2) If no value of is inside the interval of target range, and the closest values on both sides of target range are and , respectively, then either or .

Definition 2. Unsuccessful Trials: Any trial does not belong to the previous category, successful trials.

Initially, The defuzzification equation MOI defined in Eq. 12 is used in the simulations below.

The simulation results of this fuzzy controller on those fifteen images are given in Table 2. As shown in Table 2, based on those 15 images, the fuzzy controller is insensitive to the given initial value of q and has no failure for all 150 trials. To test the performance of fuzzy controller in lower distortion area, we repeat the same experiment with . The simulation results are given in Table 3. As shown in Table 3, based on those 15 images, the fuzzy controller is quite successful for low distortion area, and has no failure for all 150 trials as well. However, the average-loops-per-trial of all fifteen images increases from 8.26 of the previous simulation, TGE=1.5, to 10.407 of the current simulation, TGE=1.0. By close examining the adjusting process, we found that there were some loops wasted at the final stage of adjustment when q was close to the target but . Therefore, the process would continue, and q kept jumping back and forth until overshooting and concurred.





To improve the performance of fuzzy controller in terms of convergent speed, we set the tolerance to be 0.025 instead of 0 in the following simulations. From our experience, we know the difference of 0.025 of AGE, which equals to 0.0638 of MAE, will have very little impact on reconstructed image quality in most of the cases. The simulation results of using tolerance 0.025 are given in Tables 4 and 5. Comparing Tables 4 and 2, for TGE=1.5, the performance in terms of average-loops-per-trial is improved from 8.26 in the case of tolerance 0 to 5.38 in the case of tolerance 0.025; therefore, the convergent speed of the latter, based on those 15 images, is faster up to 34.87%, . We observe the same improvement in the case of TGE=1.0, the performance in terms of average-loops-per-trial is improved from 10.407 of tolerance 0 to 6.967 of tolerance 0.025, that is, the convergent speed of the latter is faster up to 33.05%, .




It is well known that different defuzzification equations will affect the system performance [19-25]. In this work, three equations, mean-of-maximum-inversions (MOMI), mean-of-inversions (MOI), and mean-of-centers (MOC), are used to compare their performance on this specific application. MOI is defined in Eq. 12 and the other two defuzzifications are defined as

(MOMI)(16)

(MOC)(17)

where n is the number of table entries with maximum membership value, is the inverse value of pth entry with maximum membership value, and is calculated as in Eq. 11. is the inverse value of , and is calculated as in Eqs. 13 and 14. At last, is the central value of fuzzy set from the definition, that is, for a fuzzy set A defined as (LF, CN, RG), . For example, if , then .

Recall that all previous experiments were performed using MOI; therefore, to compare the performance of those three difference equations, we use the same mechanism except defuzzfication equation for MOMI and MOC in the case of TGE=1.5 and tolerance = 0.025. Their performance summaries are given in Tables 6 and 7. According to simulation results (Tables 4, 6, and 7), the average-loops-per-trial for MOI, MOMI, and MOC are 5.38, 6.02, and 7.037, respectively. Thus, the MOI has the best performance, and the MOMI is only slightly worse than the former in terms of convergent speed. On the other hand, the MOC has the worst performance in terms of both convergent speed and accuracy. More specifically, the MOC is 1.658 average-loops-per-trial slower than MOI, and has 10 unsuccessful trials out of 150.




To compare those three equations in low distortion area, we also run the simulations in the case of TGE=1.0 and tolerance=0.025. The results are shown in Tables 8 and 9. In the low distortion area, the average-loops-per-trial for MOI, MOMI, and MOC are 6.967, 8.573, and 11.753, respectively. Therefore, the MOI still has the best performance in terms of convergent speed, but the MOMI performs much worse than the MOI in low distortion area. In addition, the difference of convergent speed is enlarged between the MOC and the other two equations, and the MOC has four unsuccessful trials out of 150.

IV. CONCLUSIONS AND DISCUSSIONS

JPEG is the most widely used image compression technique for still grayscale or color pictures; however, the variety of image source data makes the prediction of relation of control parameters and reconstructed image quality very difficult, if possible, for lossy models. As a result, the operation cost could be very high due to the need of human involvement in the compression process. To decrease the operation cost and achieve efficiency, some kinds of automatic control mechanism are needed to incorporate with JPEG. Since the relation of control parameter(s) and reconstructed image quality is essentially an ill-defined non-linear function, we proposed to incorporate the fuzzy controller with JPEG in this paper.

The controlled object, average grayscale error (AGE), is defined in Eq. 4. There are two TGEs, 1.5 and 1.0, used in experiments for average and good reconstructed image quality, respectively. In addition, fifteen various USC pictures and the JPEG software package (developed by the Independent JPEG Group) are used in this work. For simplicity, the only control parameter used in simulations is the parameter Quality (q) whose value can be adjusted to control the quantization table used at the stage of quantization. Therefore, the desired reconstructed image quality can be produced by changing the value of q during the compression process.



To evaluate the performance of designed fuzzy controller, two aspects, convergent speed and accuracy, have been investigated on three kinds of defuzzification equations, mean-of-inversions (MOI), mean-of-maximum-inversions (MOMI), and mean-of-centers (MOC), as defined in Eqs. 12, 16, and 17, respectively. Additional, ten initial values of q generated by C's rand() are used for each image to test the accuracy of the fuzzy controller. Performance summary of the designed fuzzy controller is given in Table 10.


It is clear that MOI has the best performance on convergent speed and tie with MOMI on accuracy. On the other hand, the MOC has the worst performance on both aspects.

From the design point of view, the fuzzy controller is well known for its simplicity as shown in this work. Furthermore, the fuzzy controller can achieve 100% accuracy if either MOI or MOMI is used. Since we are dealing with a collection of ill-defined non-linear functions, it is worthwhile to point out that the following special design restrictions are needed to achieve the guaranteed convergence and good performance at the same time on this application.

(1) The present adjustment is no larger than the previous adjustment except in the case of overshooting, that is, .

(2) The present adjustment is smaller than the previous adjustment in the case of overshooting, that is, .

The first criterion is needed for good performance while the second one is needed for guaranteed convergence.

In order to use the distortion ratio such as AGE as the index to guide the adjustment, a decoder is needed on source side. However, the hardware overhead is considered irrelevant since no one will manufacture the coder and decoder of JPEG separately from the marketing point of view. As the time overhead, it takes 9.7 seconds on average for a loop to complete including encoder, decoder and fuzzy controller on SUN Sparc workstation, and less two seconds are contributed by the decoder. The effect of different types of membership functions on convergent speed is the direction of ongoing research.

ACKNOWLEDGMENTS

The authors would like to thank Dr. N. Memon and Dr. J.D.M. Smith for their help during the computer experiments, and Dick Carlson for his helpful suggestions.

REFERENCES

[1] G. K. Wallace, "The JPEG still Picture Compression Standard," Communications of the ACM, vol. 34, no. 4, pp. 30-44, 1991.

[2] L.A. Zadeh, "Fuzzy Sets," Inform. Contr., vol. 8, pp. 338-353, 1965.

[3] L.A. Zadeh, "Outline of a New Approach to the Analysis of Complex Systems and Decision Processes," IEEE Trans. Syst. Man. Cybern., vol. 3, no. 1, pp. 28-44, 1973.

[4] E.M. Mamdani, "Applications of Fuzzy Algorithms for Simple Dynamic Plants," Proc. IEEE, vol. 21, no. 12, pp.1585-1588, 1974.

[5] S. Assilian, "Artificial Intelligence in the control of Real Dynamic Systems," PH.D. Thesis, Queen Mary College, London, 1974.

[6] M. Sugeno, editor. Industrial Applications of Fuzzy Control. Amsterdam: North-Holland, 1985.

[7] T. Shingu and E. Nishimori, " Fuzzy Based Automatic Focusing System for Compact Camera," Proc. of the Third International Fuzzy Systems Association (IFSA), pp. 436-439, 1989.

[8] S. Yasunobu and G. Hasegawa, " Evaluation of an Automatic Crane Operation System Based on Predictive Fuzzy Control," Control Theory and Advanced Technology, vol. 2, pp. 419-432, 1986.

[9] H. Takahashi, K. Ikeura, and T. Yamamori, "5-speed Automatic Transmission Installed Fuzzy Reasoning," Proc. of International Fuzzy Engineering Symposium '91 (IFES'91), pp. 1136-1137, 1991.

[10] W.I.M. Kickert and H.R. Van Nauta Lemke, "Application of a Fuzzy Controller in a Warm Water Plant," Automatica, vol. 12, pp. 301-308, 1976.

[11] C.P. Pappis and E.H. Mamdani, " A Fuzzy Logic Controller for a Traffic Function," IEEE Trans. Syst. Man. Cybern., vol. 7, no. 10, pp. 707-717, 1977.

[12] G.A. Carter and D.A. Rutherford, "A Heuristic Adaptive Controller for a Sinter Plant," IFAC Symp. on Automation in Mining, Met and Met Processing, Johannesburg, pp. 315-324, 1976.

[13] R.M. Tong, "A Control Engineering Review of Fuzzy Systems, " Automatica, vol. 13, pp. 559-568, 1977.

[14] C.C. Lee, "Fuzzy Logic in Control Systems: Fuzzy Logic Controller," IEEE Trans. Syst. Man. Cybern., vol. 20, no. 2, pp. 404-435, 1990.

[15] E.M. Mamdani, "Twenty Years of Fuzzy Control: Experiences Gained and Lessons Learnt," Proc. IEEE International Conf. on Fuzzy Systems, pp. 339-344, 1993.

[16] G. J. Klir and T. A. Folger, Fuzzy Sets, Uncertainty, and Information, Englewood Cliffs, NJ: Prentice-Hall, 1988.

[17] B. Kosko, Neural Networks and Fuzzy Systems: A Dynamical Systems Approach to machine Intelligence, Englewood Cliffs, NJ: Prentice-Hall, 1992.

[18] C.J. Wu and A.H. Sung, "The Application of Fuzzy Controller to JPEG," Electronics Letters, vol. 30, no. 17, pp. 1375-1376.

[19] M. Braae and D.A. Rutherford, "Fuzzy Relations in a Control Setting," Kybernetes, vol. 7, no. 3, pp. 185-188, 1978.

[20] L.I. Larkin, "A Fuzzy Logic Controller for Aircraft Flight Control," in Industrial Applications of Fuzzy Control, M. Sugeno, Ed., Amsterdam: North-Holland, pp. 87-104, 1985.

[21] E.M. Scharf and N.J. Mandic, "The Application of a fuzzy controller to the control of a multi-degree-freedom robot arm," in Industrial Applications of Fuzzy Control, M. Sugeno, Ed., Amsterdam: North-Holland, pp. 41-62, 1985.

[22] W.J.M. Kickert and E.H. Mamdani, "Analysis of a fuzzy logic controller," Fuzzy Sets Syst., vol. 1, no. 1, pp. 29-44, 1978.

[23] J.B. Kiszka, M.E. Kochanska, and D.S. Sliwinska, "The Influence of Some Parameters on the Accuracy of Fuzzy Model," in Industrial Applications of Fuzzy Control, M. Sugeno, Ed., Amsterdam: North-Holland, pp. 187-230, 1985.

[24] R.M. Tong, "Synthesis of Fuzzy Models for Industrial Processes," Int. Gen. Syst., vol. 4, pp. 143-162, 1978.

[25] T.A. Runkler and M. Glesner, "A Set of Axioms for Defuzzification Strategies Towards a Theory of Rational Defuzzification Operators," Proc. IEEE International Conf. on Fuzzy Systems, pp. 1161-1166, 1993.