A Fuzzy Inference System for Unsupervised Deblurring of Motion Blur in Electron Beam Calibration

: This paper presents a novel method of restoring the electron beam (EB) measurements that are degraded by linear motion blur. This is based on a fuzzy inference system (FIS) and Wiener inverse ﬁlter, together providing autonomy, reliability, ﬂexibility, and real-time execution. This system is capable of restoring highly degraded signals without requiring the exact knowledge of EB probe size. The FIS is formed of three inputs, eight fuzzy rules, and one output. The FIS is responsible for monitoring the restoration results, grading their validity, and choosing the one that yields to a better grade. These grades are produced autonomously by analyzing results of a Wiener inverse ﬁlter. To benchmark the performance of the system, ground truth signals obtained using an 18 µ m wire probe were compared with the restorations. Main aims are therefore: (a) Provide unsupervised deblurring for device independent EB measurement; (b) improve the reliability of the process; and (c) apply deblurring without knowing the probe size. These further facilitate the deployment and manufacturing of EB probes as well as facilitate accurate and probe-independent EB characterization. This paper’s ﬁndings also makes restoration of previously collected EB measurements easier where the probe sizes are not known nor recorded.


Introduction
The main goal of fuzzy systems is to define and control sophisticated processes by incorporating and taking advantage of human knowledge and experience.Nowadays, fuzzy logics are widely used in industry for various applications ranging from cameras to cement kilns, trains, and vacuum cleaners [1].Furthermore, deblurring techniques have versatile applications and they are either performed in spatial [2] or frequency domains [3][4][5].Hosseinzadeh [6] modeled the electron beam (EB) measurement process with a linear motion blur and evaluated three of the well-established deblurring techniques for EB restoration.In this study [6], Hosseinzadeh used a Weiner inverse filter and blind Richardson-Lucy deconvolutions to restore the EB distribution and correct the measurements through deblurring.A simple motion blur is formulated in Equation (1).
where in the spatial domain, f , g, h, and n are the ground truth signal (EB distribution) of length L f , degraded signal (measurement from probe), point spread function (PSF) of length L h , and noise respectively.Their frequency domains are represented by uppercase letters F, G, and H.In the case of electron beam measurements, the ground truth signal is the distribution of EB and the degraded signal is the measurement acquired from the probe.The electron absorption of a slit or wire probe of size L h is modeled with a PSF kernel [6].
Linear motion blur point spread function has two distinct characteristics of motion direction and length (L) [7].The PSF is known for having harmonically spaced vanishing magnitudes in the frequency domain due to its limited length in the spatial domain [8].There are several approaches to estimate L h such as log power spectrum, cepstrum, bispectrum, and pitch detection algorithms.In image deblurring jargon, it is assumed that the frequency spectrum of F is smooth and does not contain vanishing frequencies, hence any vanishing frequencies in G are associated to H [9,10].However, this assumption usually does not hold for EB measurements, especially where the L f is in the same order of L h .This similarity makes it complicated to distinguish between L f and L h and therefore compromises the deblurring process by an incorrect detection of null frequencies.Such an erroneous deblurring process is likely to produce an incorrect but convincing result, notably when f and h have remarkable cross-correlation.This ambiguity is likely to happen in EB measurements, because: (a) f and h are usually in the same order of magnitude and they have relatively high cross-correlation; and (b) the L f can be inconsistent.In Reference [6], a prior knowledge of L h is used to estimate the position of null frequency of h from the spectrum analysis of G. Hosseinzadeh limited the spectrum of G to ±15% of the nominal L h by applying a window to its log-power spectrum, thereby ignoring vanishing frequencies outside of this interval.This algorithm is available in Reference [11].This strategy relies on knowing the L h .Therefore, it is a good approach when it is known accurately.There are a few limitations with this method due to the varying nature of L f during the calibration and measurement process.As a result, the beam's vanishing frequency (or its harmonics) can be located within the applied window and cause a false detection.Furthermore, if the inaccuracy of L h is more than 15%, the null frequency of h is ignored by the window resulting in an erroneous restoration.In addition, any inaccuracy of more than ±15% cannot be compensated.
One solution to effectively address this uncertainty is to use fuzzy systems.Fuzzy inference systems are widely used to address instrumental uncertainties.A comprehensive review and explanation of fuzzy inference systems are provided in Reference [12].
It is known that a wrong estimation of L h can lead to drastic noise-like errors in the restorations [13].Furthermore, utilizing deblurring techniques for industrial purposes requires real-time, reliable, and unsupervised methods.To satisfy these requirements, this article proposes a Wiener filter that is monitored by a fuzzy inference system.A Wiener filter is selected due to its simplicity, real-time execution, and superior performance in the restoration of linear motion blur [6].The fuzzy inference system deals with the uncertainty of the deconvolution by monitoring the entire restoration process.This FIS is comprised of three crisp inputs that included the PSF length or probe size (L h ) deviation, attenuation of the vanishing frequencies, and deconvolution residue.
However, probe size deviation is an optional input, which is based on a previous rough knowledge of L h .If L h is roughly known, it serves as a reference point from which the PSF length deviation is calculated.Therefore, unlike Reference [6], prior knowledge of L h does not limit the inaccuracy compensation to ±15%.It is demonstrated in Reference [6] that the spatial domain of h has a sharper transition compared to the EB distribution ( f ).This is due to the semi-Gaussian distribution of f compared to h.Therefore, vanishing frequencies of h are expected to have higher attenuation or lower magnitude compared to f .Hence, the normalized magnitude of the detected null frequencies in G are the second crisp input to the fuzzy inference systems.The last input of the system is the quantified deblurring artifacts that are introduced during the restoration of f from g.The restored beam distributions are denoted as ( f ).These residual artifacts are inevitable and they increase as the h deviates from its mathematical definition.Extraction of residues from f is explained in section II.The output of the fuzzy system (E i ) is defuzzified to represent the quality of the restorations.This output is generated based on the definition of the fuzzy rules that are explained in the next section.
The rest of this paper is arranged as follows: Section 2 illustrates the details of FIS implementation.This includes specifying the crisp inputs and fuzzifying them, defining the membership functions, and formulating the fuzzy sets.The section continues by identifying the fuzzy rules and making an inference to generate the output.Section 3 presents the practical results of the proposed method and the ability of the system to distinguish the correct deblurring results.The values of membership functions parameters are provided and a comparison is made between implementing the fuzzy system with and without the knowledge of probe size (L h ).

Modeling and Implementation
As mentioned, when there is similarity between L f and L h it is difficult to discriminate between their null frequencies just by looking at G.This introduces an uncertainty and makes it hard to decide which null frequency belongs to the probe (H) because null frequencies can belong to either beam (F) or probe (H).To address the uncertainty of unsupervised L h detection, all the null frequencies in G are identified and only the first two nulls with lowest frequencies are extracted while avoiding the harmonics.This implies that a maximum of two null frequencies (ω i=1,2 ) are to be extracted from G.There are three possibilities based on the extracted number of null frequencies: (a) If no null frequency is detected due to L h L f , then motion blur effect is negligible and deconvolution is not necessary; (b) if a single null frequency is detected as a result of L h L f , then the deconvolution can progress without involving the fuzzy system as the null frequency belongs to L h ; (c) in case two null frequencies are extracted (ω 1 , ω 2 ), two deconvolutions are performed where each of the deconvolutions are performed by adjusting their corresponding Li=1,2 ( Li=1,2 ∝ 1/ω i=1,2 ).This is done because both ω 1 and ω 2 could be belonging to h of different sizes.
The FIS is defined with three merits to grade the deblurrings.Deblurrings are performed by two individual Weiner filters that use L1 and L2 resulting in f1 and f2 respectively.The fuzzy system produces a single crisp output deconvolution grade (E i=1,2 ) for each restoration.The restoration process that produces a higher E i is then chosen as the correct process with its corresponding Li being the correct probe size ( L h ← Li ).A single layer (non-hierarchal) fuzzy inference system of three inputs and a single output is designed to evaluate the overall deblurring process.These inputs are: PSF length deviation, null frequency magnitude, and residue, and the deconvolution grade is the only output.These inputs and the output are explained in detail as follows.

PSF Length Deviation
As mentioned, ω 1 and ω 2 are extracted to accurately adjust the L h during the restoration process.By having rough prior knowledge of the probe size (L h ) and the estimated sizes ( Li ) from G, we can define PSF length deviation as the distance between the expected and the estimations (|L h − Li |).This definition converges to zero if the estimation is close to the prior knowledge, whereas it increases if Li is deviated from L h .Two fuzzy sets (A f ar & A close ) with membership functions of µ m and µ m are defined to account for the probe inaccuracy and assign a degree of membership to each Li based on its deviation from L h .Membership functions are defined by polynomial-Z (zmf) and polynomial-S (smf).The A close fuzzy set definition and its membership function is formulated in Equation (2).A thorough evaluation of fuzzy membership functions are provided in Reference [14].
where a m and c m are the membership function parameters that are found heuristically through analysis of several measurements.

Null Frequency Magnitude
The second input of the fuzzy system is the magnitude of the extracted null frequencies.This is extracted from the normalized log-power spectrum of g and has a dynamic range of 0 to 1 dB, demonstrated in Figure 1.
The second input of the fuzzy system is the magnitude of the extracted null frequencies.This is extracted from the normalized log-power spectrum of  and has a dynamic range of 0 to 1 dB, demonstrated in Figure 1.As explained, ℎ is most likely to have rapid spatial transitions compared to .This implies that  is likely to have the nulls with higher attenuation in  (nulls with lower magnitude).As a result, two fuzzy sets ( ℎℎ &   ) with membership functions of   ′ and   are defined to assign a higher membership value to the nulls with more attenuation (or lower magnitude), whereas a lower degree of membership is assigned to less attenuated (higher magnitude) nulls.Membership functions are defined with zmf and sfm.  is formulated in Equation ( 3), where   is the normalized frequency spectrum of the degraded signal  and   and   are the membership function parameters.  membership function definition is similar to   as they are both defined by smf.

Deconvolution Artifact Residues
Deconvolutions are performed using the Wiener inverse filtering process in Equation ( 4).
where in the frequency domain,  �  is the restored ground truth signal and  is the signal-to-noise ratio.After the deconvolutions,  ̂=1,2 has shorter lengths in spatial domain compared to .We first normalized  and both of the restorations ( ̂=1,2 ) between [0, −1],   is then shifted so its minimum is matched with the minimums of each  ̂ in the spatial domain to obtain  �  .Finally, every restoration residue (  ) is quantified as in Equation ( 5).
The deconvolution process using both of the extracted PSFs and their corresponding residues are showed in Figure 2. The deconvolution was performed with a Wiener inverse filter, where ℎ is formulated in Equation (6).As explained, h is most likely to have rapid spatial transitions compared to f .This implies that H is likely to have the nulls with higher attenuation in G (nulls with lower magnitude).As a result, two fuzzy sets (B high & B Low ) with membership functions of µ o and µ o are defined to assign a higher membership value to the nulls with more attenuation (or lower magnitude), whereas a lower degree of membership is assigned to less attenuated (higher magnitude) nulls.Membership functions are defined with zmf and sfm.B Low is formulated in Equation ( 3), where G N is the normalized frequency spectrum of the degraded signal G and a o and c o are the membership function parameters.A Far membership function definition is similar to B Low as they are both defined by smf.

Deconvolution Artifact Residues
Deconvolutions are performed using the Wiener inverse filtering process in Equation ( 4).
where in the frequency domain, Fi is the restored ground truth signal and SNR is the signal-to-noise ratio.After the deconvolutions, fi=1,2 has shorter lengths in spatial domain compared to g.We first normalized g and both of the restorations ( fi=1,2 ) between [0, −1], g N is then shifted so its minimum is matched with the minimums of each fi in the spatial domain to obtain ĝN .Finally, every restoration residue (r i ) is quantified as in Equation (5).
The deconvolution process using both of the extracted PSFs and their corresponding residues are showed in Figure 2. The deconvolution was performed with a Wiener inverse filter, where h is formulated in Equation ( 6).Two fuzzy sets (  and  ℎℎ ) are defined with membership functions of   and   ′ using zmf and smf respectively, where the overall shape of the functions is determined by   and   .These functions are designed to assign a higher degree of membership to the  �  that produces a smaller number of residues after restoration.

Deconvolution Grade
All the combinations of the aforementioned inputs are used to form eight if-then rule statements with different weights.These statements, with their corresponding weights, are provided in Table 1.Fuzzy AND operator is then used for the implication of the fuzzy consequences.Two fuzzy sets (C low and C high ) are defined with membership functions of µ r and µ r using zmf and smf respectively, where the overall shape of the functions is determined by a r and c r .These functions are designed to assign a higher degree of membership to the Li that produces a smaller number of residues after restoration.

Deconvolution Grade
All the combinations of the aforementioned inputs are used to form eight if-then rule statements with different weights.These statements, with their corresponding weights, are provided in Table 1.Fuzzy AND operator is then used for the implication of the fuzzy consequences.
Rule weight is added to scale the consequences and account for the certainty of the rules.The consequence is the restoration quality with two fuzzy sets (D good & D bad ) and membership functions of µ q and µ q respectively defined by smf and zmf.Aggregations of the rules are performed by using a Zadeh T-norm and defuzzifications are carried out by mean of maximum (MoM) method [15].The resulting crisp values are the deconvolution grades (E i=1,2 ).Therefore, there is a grade (E i=1,2 ) for each deconvolution.In other words, for each fi=1,2 that is deblurred by its corresponding h Li=1,2 , there is an overall grade of restoration (E i=1,2 ).According to the definition of the consequence membership functions, a greater value of E i represents a better restoration and, on the contrary, a lower value of E i represents a possible erroneous process, (E i is ranging from 0 to 1).With this proposed system, if by mistake L f is used instead of L h in the formation of the h (Equation ( 6)), then the resulting E i will be lower.Overall, E 1 and E 2 are used comparatively to determine and select the best restoration between f1 and f2 that are emerged from restoring a degraded sample (g).This proposed system and its overall restoration processes are demonstrated in Figure 3.
membership functions, a greater value of   represents a better restoration and, on the contrary, a lower value of   represents a possible erroneous process, (  is ranging from 0 to 1).With this proposed system, if by mistake   is used instead of  ℎ in the formation of the ℎ (Equation ( 6)), then the resulting   will be lower.Overall,  1 and  2 are used comparatively to determine and select the best restoration between  ̂1 and  ̂2 that are emerged from restoring a degraded sample ().This proposed system and its overall restoration processes are demonstrated in Figure 3.

Membership Function Parameters
Membership function parameters were investigated pragmatically by testing the explained algorithm for various degraded EB measurement samples.In all degraded measurements, ℎ and  had approximately similar sizes as a result of which  � 1 ≅  � 2 .The membership functions were designed with smooth transitions to provide a general solution and more flexibility, except for the attenuation.To further discriminate between  1 and  2 , the attenuation membership function parameters were adjusted to have more emphasis between the interval of 0 to 0.3 dB.This intuitive definition was done by observing the magnitude of null frequencies in several degraded signals where the attenuation of the null frequencies was always under 0.3 dB.The membership function parameters are presented in Table 2.The membership functions of attenuation ( ℎℎ &   ) and residue (  &  ℎℎ ) fuzzy sets are depicted in Figure 4, according to their values in Table 2.The fuzzy sets of PSF deviation and restoration quality were also defined with the similar membership functions to that of residues.

Membership Function Parameters
Membership function parameters were investigated pragmatically by testing the explained algorithm for various degraded EB measurement samples.In all degraded measurements, h and f had approximately similar sizes as a result of which L1 ∼ = L2 .The membership functions were designed with smooth transitions to provide a general solution and more flexibility, except for the attenuation.To further discriminate between E 1 and E 2 , the attenuation membership function parameters were adjusted to have more emphasis between the interval of 0 to 0.3 dB.This intuitive definition was done by observing the magnitude of null frequencies in several degraded signals where the attenuation of the null frequencies was always under 0.3 dB.The membership function parameters are presented in Table 2.
a o c o a r c r a r c r a q c q a q c q 0.02 1 0.04 1 0.02 0.3 0.05 0.3 0 The membership functions of attenuation (B high & B Low ) and residue (C low & C high ) fuzzy sets are depicted in Figure 4, according to their values in Table 2.The fuzzy sets of PSF deviation and restoration quality were also defined with the similar membership functions to that of residues.The analysis of a few of the samples are shown in Figures 5 and 6.For a few of the EB measurements, the  ℎ (probe sizes) were known to be 1.00, 0.20, and 0.40 mm respectively.The crisp fuzzy inputs and deconvolution grades   were also provided for every sample.The restoration that resulted in the higher   was selected by the system as the correct solution and its corresponding  �  therefore represents the probe size ( � ℎ ←  �  ).To validate the proposed system with the ground truth signal () [6], both restorations ( ̂1,2 ) were compared against their ground truth signal using crosscorrelation.For the  ̂ with the higher   , the cross-correlation of  ̂ and  also produced greater coefficients, supporting the accuracy and reliability of the system.As another benchmark, full width at half maximum (FWHM) analysis was used, as it is a popular measure in the EB calibration jargon.The FWHM of  and the  ̂ that had the higher   produced a similar result, further confirming that the FIS had successfully identified the correct restoration process.The analysis of a few of the samples are shown in Figures 5 and 6.For a few of the EB measurements, the L h (probe sizes) were known to be 1.00, 0.20, and 0.40 mm respectively.The crisp fuzzy inputs and deconvolution grades E i were also provided for every sample.The restoration that resulted in the higher E i was selected by the system as the correct solution and its corresponding Li therefore represents the probe size ( Lh ← Li ) .To validate the proposed system with the ground truth signal ( f ) [6], both restorations ( f1,2 ) were compared against their ground truth signal using cross-correlation.For the fi with the higher E i , the cross-correlation of fi and f also produced greater coefficients, supporting the accuracy and reliability of the system.As another benchmark, full width at half maximum (FWHM) analysis was used, as it is a popular measure in the EB calibration jargon.The FWHM of f and the fi that had the higher E i produced a similar result, further confirming that the FIS had successfully identified the correct restoration process.The analysis of a few of the samples are shown in Figures 5 and 6.For a few of the EB measurements, the  ℎ (probe sizes) were known to be 1.00, 0.20, and 0.40 mm respectively.The crisp fuzzy inputs and deconvolution grades   were also provided for every sample.The restoration that resulted in the higher   was selected by the system as the correct solution and its corresponding  �  therefore represents the probe size ( � ℎ ←  �  ).To validate the proposed system with the ground truth signal () [6], both restorations ( ̂1,2 ) were compared against their ground truth signal using crosscorrelation.For the  ̂ with the higher   , the cross-correlation of  ̂ and  also produced greater coefficients, supporting the accuracy and reliability of the system.As another benchmark, full width at half maximum (FWHM) analysis was used, as it is a popular measure in the EB calibration jargon.The FWHM of  and the  ̂ that had the higher   produced a similar result, further confirming that the FIS had successfully identified the correct restoration process.

Conclusions and Discussion
The algorithm showed superior performance when a rough prior knowledge of  ℎ was provided for the fuzzy inference system.The Δ  = (| 1 −  2 |) was greater than 0.5 thereby clearly identifying and segregating the correct deconvolution process.The algorithm was also tested without including the PSF knowledge, in which case Δ  was in the interval of 0.1 to 0.5, which was enough to confidently separate the correct deconvolution process.
Figure 6 depicted a special case where  had a null frequency at  ℎ = 120 kHz with a normalized magnitude of 0.09 dB, whereas,  null was at   = 170 kHz with a magnitude of 0.02 dB and had four times higher attenuation.Although   had a magnitude that was in its favor, the PSF deviation of 0.51 was not, yet the PSF deviation outweighed its low magnitude and the correct restoration was successfully distinguished with 14% separation in the deconvolution grades (| 1 −  2 | = 0.14).This high attenuation of   was most likely due to it being closer to the second harmonic of  ℎ and, therefore, it experienced further attenuation.Nevertheless, owing to the FIS implementation, the correct restoration process was identified.All the possible rules were considered for the implementation of this FIS and its tuning was performed heuristically by an expert.However, clustering algorithms could be used for FIS with multiple inputs and membership functions to determine the optimum number of rules.Furthermore, adaptive FISs can be used to automate the tuning and learning process of the FIS in a more complicated and complex scenario.

Figure 1 .
Figure1.Normalized power spectrum of  exhibits  1 and  2 at 0.12 and 0.165 MHz frequencies with their harmonics at higher frequencies.

Figure 1 .
Figure 1.Normalized power spectrum of G exhibits ω 1 and ω 2 at 0.12 and 0.165 MHz frequencies with their harmonics at higher frequencies.

9 Figure 2 .
Figure 2. Deconvolution of the degraded pulse in Figure 1, using two different point spread function (PSF) lengths and demonstration of their deconvolution residues.

Figure 2 .
Figure 2. Deconvolution of the degraded pulse in Figure 1, using two different point spread function (PSF) lengths and demonstration of their deconvolution residues.

Figure 3 .
Figure 3. Process diagram,  �  connections to the fuzzy inference system (FIS) are optional.

Figure 3 .
Figure 3. Process diagram, Li connections to the fuzzy inference system (FIS) are optional.

Figure 5 .
Figure 5. Null frequencies in the spectrum of the degraded pulse.Result of restoration with detected null frequencies, expected PSF length of 1 mm on the left and 0.2 mm on the right.

Figure 5 .
Figure 5. Null frequencies in the spectrum of the degraded pulse.Result of restoration with detected null frequencies, expected PSF length of 1 mm on the left and 0.2 mm on the right.

Figure 5 .
Figure 5. Null frequencies in the spectrum of the degraded pulse.Result of restoration with detected null frequencies, expected PSF length of 1 mm on the left and 0.2 mm on the right.

Figure 6 .
Figure 6.Null frequencies in the spectrum of the degraded pulse.Result of restoration with detected null frequencies, expected PSF length of 0.4 mm.

Table 1 .
Rule base formation criteria.
[15] weight is added to scale the consequences and account for the certainty of the rules.The consequence is the restoration quality with two fuzzy sets (  &   ) and membership functions of   and   ′ respectively defined by smf and zmf.Aggregations of the rules are performed by using a Zadeh T-norm and defuzzifications are carried out by mean of maximum (MoM) method[15].The

Table 1 .
Rule base formation criteria.

Table 2 .
Membership function definition details.

Table 2 .
Membership function definition details.