Automatic crack detection in civil infrastructure based on a hybrid fine tuned MnasNet and adaptive patching Authors: Kun Li, Feng He, Xiaojun Zhao Published: 2025 ABSTRACT AbstractDetection of cracks is a critical area of automation that would help guarantee the safety and durability of the civil infrastructure at the lowest cost of upkeep. Current image processing and deep learning models are usually weak in real-life scenarios, require excessive resources, or feature manual features extraction. To overcome these shortcomings, this paper presents a new vision-based framework of crack detection that combines the lightweight MnasNet CNN with the Upgraded Lotus Effect Optimization (ULEO) algorithm that automatically adjusts the hyperparameters. The first structural health monitoring use of chaos theory and Levy flight dynamics is ULEO, which is designed to improve convergence and eliminate local optima. Another dynamic patching mechanism used in the framework is that the patch sizes utilize the complexity of the image to adjust dynamically to enhance accuracy without causing a run time increase. The proposed method was tested on the CRACK500 dataset and with various cross-validation configurations, it achieved an accuracy of 97.1, sensitivity of 96.0, specificity of 97.8, and an F1-score of 95.6, outperforming other benchmarks including VGG16, OpenMV-CNN, XGBoost and XAI/t-SNE. Particularly, the proposed model provides this performance during a 0.05 s per image computational time, which makes it more efficient and suitable to use in mobile and embedded platforms. The high accuracy and low computational intensity of the MnasNet/ULEO model make it especially appropriate with real-time and mobile-based crack inspection, which creates a new self-optimized intelligent vision model of defect detection in civil, mechanical, and industrial systems.Keywords: Crack detection, Additive manufacturing, MnasNet, Hyperparameter optimization, Upgraded lotus effect optimization algorithm, Surface defectsSubject terms: Engineering, Mathematics and computing Introduction Since its inception, image processing has seen increasing applications, such as in industrial inspection, medical imaging, remote sensing, and in the past few decades, the rapid advancement in digital camera technology has inspired further research in this burgeoning field of computer vision1. Digitally based imaging to acquire images and then detect and classify cracks has progressed in iterations over the past decade2. Because of these advantages, digital image processing is widely used, but it performs a huge amount of information and automation in the process of evaluating crack characteristics3. Reliable crack detection is critical for safety and reliability of structures, equipment’s, and materials4. Crack detection has traditionally been a manual process, carried out by trained professionals5. This is effective but labor-intensive, time-consuming, and error-prone6. Automated crack detection methods that use image processing techniques (IPTs) have been created to overcome these obstacles7. An alternative procedure are IPTs that filter images and reduce relevant features for the crack’s extraction and classification8. Nevertheless, traditional IPTs tend to perform poorly in different practical scenes and against different types of cracks, which greatly reduces their practical effectiveness9. This scenario facilitates the advancement of more efficient and reliable crack detecting systems that can operate under various settings10. In this decade, deep learning has emerged as a pervasive technology for enhancing image processing capabilities11. Notably, convolutional neural networks (CNNs) have demonstrated exceptional efficacy in tasks including identifying objects in images, image classification, and segmentation using semantics12. Of these CNNs, MnasNet is a state-of-the-art construction that has been shown to optimize the efficiency-accuracy trade-off quite well. Using MnasNet, we can build better systems capable of detecting cracks where images are simple13. Falaschetti et al.14 established a vision system according to the two precise and lightweight Convolutional Neural Network methods used within a platform which needed low power and cost, called the OpenMV Cam H7 Plus. It was implemented for identifying and managing immediate concrete cracks, that was appropriate for detecting an early caution system’s prototype. The system had to offer a great accuracy level, and not give wrong alarms in order to be beneficial. Also, it had to be stingy in computational assets in a way that it became implemented in low power, transferable systems, which could be organized on the field. So, first, the various common CNNs were analyzed through applying to the identification of concrete crack for discovering the network which had the minimum parameter amount and memory storage. Second, the CNN framework’s accuracy and memory use enactment was compared with the smallest network, LeNet, which was trained on two dissimilar image datasets, namely the SDNET2018 dataset, and the Concrete Crack Images for categorizing dataset that were employed on the system OpenMV Cam H7 Plus. The suggested CNN frameworks performed agreeably by means of just one small fraction between 26 to 6% of the memory needed for LeNet. Actually, it offered a good accuracy within all of the assessed datasets with just one marginal growth within implication period. Golding15 developed a DL or deep learning based autonomous identification of crack approach through the CNN method. Actually, for enhancing the CNN categorization enactment for improved pixel segmentation, 40,000 RGB images were treated earlier than processing a pretrained VGG16 framework for designing various CNN methods. The edge detection, grayscale, and thresholding approaches had been employed within IP or image processing for detecting the crack, however they were not used within deep learning. The research showed that the grayscale methods with a 99.331% of F1 score for 10 epochs, and a 99.549% of 20 epochs, performed similar to the RGB methods with a 99.432% of F1 score for 10 epochs, and a 99.533% for 20 epochs. In fact, the grayscale’s enactment improved at a higher rate with additional processing training (RGB: + 2 TP, + 4 TN images; grayscale: + 2 TP, + 11 TN images). The edge-detection and thresholding methods had decreased enactment in comparison with the RGB methods to (20-epoch F1 score to RGB: thresholding − 0.723%, edge detection − 0.402%). So, the DL identification of crack was not based on color. Therefore, the method had effects on the concrete substructures’ automated crack recognition. Gonthina16 tried to establish the deep CNN method for detecting the cracks. Actually, the cracks’ quantification had been specified by means of the image processing technique through creating the Python source code. The offered CNN framework was established employing the VGG16 model and was processed on a dataset which was pre-build-up and owned fourty-thousands images with size 227 × 227. Also, the outcomes were achieved with a 94.6% of accuracy. 280 images were gathered by hand, regardless of size of pixel and the space between the source and surface with recognized width of crack, which were used within a training process of image. The analysis of the method’s trail outcomes and the achieved measurements of the real physical employment of a microscope of crack was assumed for guaranteeing the efficiency of the prearranged DIP or digital image processing systems. The outcomes of quantification attained over Image processing with the accuracy percentage in a range of 65 to 98% through comparing with the measurements that were achieved by means of the actual physical method. Geetha and Sim17 integrated a Fourier-based 1D deep learning method and image binarization in order to recognize and categorize the concrete crack structures. As an originator of deep learning, binarization of image removed probable CCR or Crack Candidate Regions and excluded the plane structural background throughout deep learning processing and analyzing. Actually, the metadata in the 1D DL method was produced and assessed by means of local XAI that within t-SNE or t-distributed Stochastic Neighborhood Embedding was employed for visualizing the information transmission in the hidden layers. The suggested technique allowed immediate crack pixel-level categorization at the rate of 2 images on a mobile platform that had few computational services. Laxman18 developed an inclusive automated recognition of crack and assessment structure of crack depth for structures which were concrete through employing portable devices’ images. First of all, a binary-class CNN method was established for identifying the cracks on a surface that was concrete, in an automatic way. Then, a combined CNN method integrating the convolutional characteristic removal layers and regression approaches, such as XGBoost and RF, was established for forecasting the cracks’ depth in an automatic way. At last, the framework had been confirmed on a RC or reinforced concrete slab, and the outcomes showed that the methods were reliable and accurate for cracks’ automatic examination that was able to assist in assessing the concrete structure’s situation and selecting appropriate techniques of repair. The automation of crack detection has become a critically important factor for structural health monitoring considering the urgency of maintaining the safety, durability, and cost-effective maintenance of aging civil infrastructure. Traditional image processing techniques (IPTs) have long been in use for defect identification, but their performance has, from the very beginning, been limited by sensitivity to environmental noise, variation in crack morphology, and dependence on hand-crafted features that lack generalization across real-world situations19. The aforementioned constraints hold particularly strongly in complex scenarios characterized by shadows, surface roughness, and background clutter that are ubiquitous to field deployability of inspection systems, where IPTs are likely to be high in false positive or false negative rates. Although deep learning models like VGG16 and lightweight CNNs (e.g., OpenMV-CNN) have shown promise in improving accuracy, they either suffer from excessive computational burden or lack systematic hyperparameter optimization, which limits their adaptability and deployment on resource-constrained edge devices. To meet this demand, the new approach in this study provides a vision-based crack detection system that will optimally use MnasNet’s lightweight but effective form to be coupled with a newly improved upgraded lotus effect optimization (ULEO) algorithm, marking the first-ever site of ULEO-and its bio-inspired predecessor LEA-in the structural health inspection domain. Our method uses ULEO to fine-tune important hyperparameters under a chaotic search coupled with Lévy flight dynamics for significantly enhanced convergence speed and global optimality instead of the conventional fixed architecture or the various optimizers it uses. An adaptive patching is also put forward, which is able to customize patch sizes to complexity levels within the image allowing for accurate detection of fine cracks and minimizing computational redundancy. Tested on the CRACK500 benchmark, our MnasNet/ULEO model outperforms all others in different terms of state-of-the-art performance, and embedded CNNs, showing significant advantages both in accuracy and robustness. This is both a breakthrough for hyperparameter-optimized mobile deployable SHM systems and a step towards using bio-inspired optimization in more civil, mechanical, and manufacturing applications that pertain to vision-based defect detection. Data description The efficacy of the proposed crack identification technique in this study is assessed utilizing the CRACK500 dataset, which is publically accessible with a Kaggle account20. The images were obtained using Temple university based on cell phones. The dataset including 1896 images for training and 1124 image with different sizes for testing in the two labels of label “crack” and ”uncracked”. This dataset has other dimensions such as 640 × 360 pixels and 648 × 848 pixels and is based on the number of pixel-level labels. An advantage of the CRACK500 dataset is that it contains images with multiple obstructions. The dataset includes shadows, scale, surface roughness, holes, edges and background debris, to replicate real-world conditions. Figure 1 shows examples of concrete patterns from the CRACK500 data set. Examples of concrete patterns from the CRACK500 data set: (A) cracked and (B) uncracked samples. Figure 1 presents two groups of surface images. The initial group is designated as “cracked,” whilst the subsequent group is identified as “uncracked”. The “cracked” collection showcases diverse surfaces of concrete, with distinct fissures emphasizing varying patterns and levels of deterioration. In contrast, surfaces without obvious fractures are analyzed by the “uncracked” set. In order to train and validate machine learning models for the autonomous detection of cracks in concrete surfaces, crack images are necessary. The visual differentiation aids in the development of robust methods for tracking structural health and management. Methodology During the present study, an optimized MnasNet artificial neural network is used to suggest a vision-based fracture detecting system. A method is proposed to improve the overall accuracy and reduce false detection rates in crack detection from images. To do so, we performed preprocessing steps like noise elimination and contrast adjustment to improve their quality. Then, adaptive patching is applied to the images, resulting in the formation of content-based patches where each patch contained a fragment of the images, allowing for the neural network to recognize cracks of all sizes and shapes that is shown in Fig. 2. The pipeline schematic of the proposed methodology. To adapt MnasNet to crack detection, we fine-tuned it on the Crack500 dataset. Optimizing the hyper parameters with Upgraded Lotus effect optimization showed better performance than Matrix based optimization. The efficacy of our method for uncovering cracks in diverse and challenging scenarios was validated on a standard benchmark. Materials and methods In the following, a detailed explanation of the methods used in your study have been provided. Image preprocessing Preprocessing is crucial for all image processing operations, including crack detection. Its objective is to enhance the image’s input accuracy, which can be achieved by improving contrast and lowering noise; this provides better input for the neural network, allowing for more accurate and robust feature extraction and detection. An example of this would be pre-processing that will enhance a vision-based crack detection network (MnasNet). Noise reduction Image noise can be an issue if the datasets are not consistent. In this paper, the onset of different types of frames from multiple websites can benefit the model efficiency by providing a noise reduction. Median filtering is used for this purpose in this study21. Median filtering substitute the value of the pixels with median value of their surrounding pixel values which smooths edges while preserving desired features in the image22. Let be the total number of images where denotes a set of images and represents image, and we can use a square window (filtering in the form of the users. The above median value of pixels on a window centered on in can be defined as. Figure 3 presents the algorithm flowchart of the median filtering. The pipeline flowchart of the median filtering. Figure 4 is a sample example of how median filtering is applied on a noisy image. The aim of a median filter is to remove the noise from an image whilst still keeping the details and structural properties of an image. Sample example of median filtering: (A) raw image, (B) filtered image. As can be observed from Fig. 4, we simulated a raw image including gaussian noise. Then, a median filtering is applied to the image to show the effectiveness of this filter. As can be observed, using median filtering can improve the image quality by removing (or at least reducing) the effective noises that is important in crack detection to not detected as cracks. Contrast enhancement As previously mentioned, due to the variations present in the image frames, there is a need for enhancement on the original images. In this stage, a contrast enhancement technique has been applied to increase contrast of the image to provide a high accuracy in crack detection23. This study uses Contrast Limited Adaptive Histogram Equalization (CLAHE) that computes the histogram equalization separately for tiles in an image by conducting a stated clip limit24. The deal avoids getting image homogeneous areas artifacts and noise multiplies. Each output is stitched with others based on bilinear interpolation25. The algorithm flowchart of the CLAHE is provided in Fig. 5. The algorithm flowchart of the CLAHE. In this context, refer to the original raw image, which is segmented into smaller, non-overlapping sub-blocks, each with dimensions of ×26. The histogram for each sub-block is calculated, which represents the distribution of pixel intensities within that specific sub-block. The equalized histogram, denoted as HE, is defined by limiting values that exceed × and those that fall below × to ×, where is a detailed constant27. Additionally, the cumulative distribution function (CDF) is derived from the equalized histogram HE28. grid size in this study is considered 5 × 5 and the maximum value of limiting the contrast enhancement is set 2. Figure 6 shows a sample example of applying the CLAHE to a raw image. Sample example of applying the CLAHE to a raw image: (A) raw image, and (B) filtered image. As can be observed in the figure, the original image (A) is somewhat a cracked texture and has multiple intensity/contrast levels with relatively low contrast and lacks strength between features and textures. This image also has a very skewed histogram, with many of its pixel intensity values pretty similar. The filtered image (B), obtained by using the CLAHE algorithm on the raw image, exhibits improved contrast, allowing for better differentiation between various features and textures. We can also see, the histogram of the filtered image is more uniform, Thus, a wider range of intensity values. This clearly shows, how CLAHE improves image quality. Class imbalance is a typical problem of datasets applied to binary classification problems, like crack detection where one of the classes (e.g., the uncracked one) may vastly outnumber the other one (e.g., the cracked one). This imbalance has the potential to affect the capacities of the model in recognition of cracks in CRACK500 dataset. To counter this, we used two main techniques which are the data augmentation and the weight of classes. The samples with the ‘cracked’ were augmented by data augmentation methods such as random rotations, flips and translations to enhance the probability of being represented in the training set. The strategy not only balanced the classes distribution but it also increased the generalization ability of the model as it was exposed to a greater range of cracks patterns. Also, the training process applied class weighting, in which the minority class (cracked) was given a greater weight to give the model a greater punishment on misclassifying these cases. Particularly, the weights of the classes were calculated as the inverse of the class frequencies such that, a more emphasis is given to underrepresented class by the model. Through combining these measures, we sought to address the issue of class imbalance and enhance the general performance of the crack detection model, especially on the accurate detection and classification of the cracked surfaces. MnasNet: efficient neural architecture search MnasNet has been found to be efficacious and lightweight CNN structure that has been developed via structure search29. This aims to strike a balance between quality and modeling size. This makes it suitable for application on mobile devices and contexts with constrained resources. Neural architecture search NAS (Neural architecture search) has been found to be an automatic procedure of finding efficacious network structures. Considering the MnasNet, NAS has been utilized for exploring network configurations’ wide solution space. This seeks to identify networks that can offer an equitable compromise between accuracy and computing efficiency. Solution space strategy The search space of the network is composed of diverse blocks of building, comprising squeeze-and-excitation operations, depthwise separable convolutions, and convolutional layers30. These blocks have been inserted into hierarchical design, which form the eventual model. the solution space has been developed for including several possible frameworks that allowed for various and effective networks. Reinforcement learning-based search MnasNet makes use of an RL (Reinforcement Learning) agent to efficiently traverse the vast solution space. The RL learns to select the most talented components to construct the model by approaching the architectural search as a sequence of decisions. The agent was developed on a proxy dataset, and its effectiveness was evaluated based on a number of measures, such as efficiency and model size. Differentiable architecture search MnasNet integrates DARTS (Differentiable Architecture Search)15, framing the architectural search as a continuous optimization problem. DARTS reduces the particular operational options inside the solution space, enabling the application of optimization based on gradients. This Facilitates efficient global exploration of the solution space and aids in recognizing high-performing architectures. Multi-objective optimization MnasNet incorporates various goals throughout the architecture search procedure. Besides striving for high accuracy, it also focuses on reducing the size of model and demands of computation. This optimization across multiple objectives is accomplished using Pareto fronts, where structures that present different balances between efficiency and accuracy have been recognized. Resource-aware modeling MnasNet employs resource-aware modelling to ensure that the architectures it discovers are suitable for mobile device applications. This procedure considers factors such as inference speed, energy cost, and memory utilization throughout the search phase. By implementing modeling of resource-aware, it becomes possible to recognize structures that excel in performance while also meeting the limitations of mobile applications. Transfer learning MnasNet employs transfer learning to enhance the efficacy of the designs it identifies. Pre-trained models such as Efficient Net or MobileNet provide the starting weights for the architectures under investigation. The transmission of knowledge accelerates training and improves overall precision. MnasNet architecture The MnasNet architecture ultimately comprises a series of stacked mobile inverted bottleneck (MBConv) blocks, where each block has several operations chosen through the NAS. The present blocks effectively comprehend hierarchical representations, enabling the model to obtain great accuracy while using a relatively restricted quantity of variables. Figure 7 shows the structure of MnasNet. The schematic structure of the MnasNet. Mobile inverted bottleneck block (MBConv Block) A fundamental component of the MnasNet architecture is the MBConv. Depthwise convolution, expansion, addition, projection, and squeeze-and-excitation are among the processes that comprise it. The following is a calculation of the mathematical equations that define the MBConv block: Expansion:1 Expansion:1 If the expanded tensor is represented by , the tensor of is represented by , and the biases and weights in this respect are shown by and . Depthwise convolution:2 Depthwise convolution:2 here, and , have been used to display the biases and weights, whereas has been used to display the depthwise convolved tensor. Squeeze-and-excitation:3 Squeeze-and-excitation:3 Here, element-wise multiplication is shown by , the sigmoid activation function is shown by , the ReLU activation function is shown by δ, and the squeeze-and-excitation is shown by . Furthermore, and , as well as and . have been used to represent the biases and weights in this respect. Projection: is used to depict the projected tensor, while and are used to explain the projection’s biases and weights. Addition: has been used to represent the output tensor of the proposed model.5 Addition: has been used to represent the output tensor of the proposed model.5 A combination of accuracy and efficiency metrics has been used as the performance metric to improve MnasNet. In order to evaluate efficiency, a weighted aggregation and accuracy of inference latency and model size have been measured using the loss of negative log-likelihood. The model’s performance on the validation dataset is assessed by the accuracy performance index. The negative log-likelihood loss, which is frequently used for classification issues, has been applied. The performance index’s accuracy has been stated as follows: has been used to represent the output tensor of the proposed model. A combination of accuracy and efficiency metrics has been used as the performance metric to improve MnasNet. In order to evaluate efficiency, a weighted aggregation and accuracy of inference latency and model size have been measured using the loss of negative log-likelihood. The model’s performance on the validation dataset is assessed by the accuracy performance index. The negative log-likelihood loss, which is frequently used for classification issues, has been applied. The performance index’s accuracy has been stated as follows: where represents the accuracy of the performance index, is the total number of instances in the validation dataset, and represents the number of classes. Additionally, if the sample is in the class, the true label of the sample and class has a value of 1; if not, it has a value of 0. Using , the predicted for the sample within the class has been shown. The performance index’s effectiveness is a representation of the model’s size and inference latency, both of which have been proven to be extremely important when using MnasNet on devices with limited resources. A weighted sum of latency inference and model size has been used to quantify the performance index’s effectiveness. here, the efficiency of the performance index has been represented via , the size of model has been demonstrated by that has been assessed regarding the whole amount of memory footprints or variables, and the inference latency has been depicted via that has been evaluated regarding the mean time spent for procuring one input. The hyperparameters have been depicted via and , controlling the relational significance of inference latency and size of model in all effectiveness metrics. influences size of step of the optimizer’s updates; much rates can speed up conjunction but might overshoot the best solutions, while lower rates may need additional epochs of training yet allow for more precise upgrades. The batch size has been represented via that influences the noise level and constancy of the gradient estimation; larger batches yield more constant estimation but demand more memory, while smaller batches are additional efficient computationally but result in noisier gradients. The number of epochs indicates the quantity of times that the entire dataset has been fed into the model; while increasing epochs might enhance convergence, it can also lead to overfitting. Momentum, denoted as , plays a role in optimizers such as SGD and suggests a velocity element that aggregates upgrades within a specific way, enabling the algorithm to gain momentum and speed up convergence. In order to achieve a balance between local and global search, learning rate decay is the process of progressively decreasing the rate of learning. This can be achieved using techniques such as step decay, exponential decay, or customized learning rate. Finally, weight initialization techniques, such as He or Xavier initialization, determine the initial weights of the network and can affect the optimization process and convergence time, helping to avoid problems like vanishing or bursting gradients and accelerating convergence. Upgraded Lotus effect optimization The concept is predicated on the following elements, taking considered the importance of the explotation and exploration procedures in optimization techniques along with their presence in the life of the lotus flower31: In the exploration, insects such as dragonflies facilitate the dispersal of seeds, and their movements can be adapted to enhance this process, as illustrated by the DOA. In the exploration, insects such as dragonflies facilitate the dispersal of seeds, and their movements can be adapted to enhance this process, as illustrated by the DOA. As the flower blossoms, gathering about a central core, it whitethorn serve as a source of inspiration for local search through employing a multi-population approach that clusters the search factors, similar to the arrangement of Lotus blooms. As the flower blossoms, gathering about a central core, it whitethorn serve as a source of inspiration for local search through employing a multi-population approach that clusters the search factors, similar to the arrangement of Lotus blooms. The process of extraction reinforcement, which involves directing water over the leaves of this plant and allowing it to exit through the nearest openings on the leaf surface, could serve as a basis for implementing a local search within the algorithm to recognize optimal points. This could be achieved based on local searching. The process of extraction reinforcement, which involves directing water over the leaves of this plant and allowing it to exit through the nearest openings on the leaf surface, could serve as a basis for implementing a local search within the algorithm to recognize optimal points. This could be achieved based on local searching. LEA exploration stage Global organic pollination is carried out by the LEA dragonflies, that is the same to the exploration phase of the proposed algorithm. The dragonfly algorithm includes 3 basic principles observed in insect swarms: alignment, separation, and cohesion along with 2 additional concepts related to enemy and food, to effectively simulate the intelligent behavior exhibited by dragonflies. Separation shows the mechanism that prevents an agent from colliding with around solutions. Configuration demonstrates the velocity matching of solutions to that of other solutions around. Cohesion shows the propensity of solutions to move towards the group’s mass center within a neighborhood. The primary goal for the swarms is survival. Consequently, individuals must be drawn towards food source while simultaneously avoiding enemies. Considering these 2 manners, there are 5 factors that influence the updating of individuals ‘positions within the swarm, individually of which could be represented statistically. The following is the separation calculation: Here, is the number of individuals in the neighborhood, shows the location of the current individual with index in the evolution iteration , and shows the location of the jth individual in the neighborhood in the evolution iteration t. Here is how alignment is taken into consideration: where, displays the neighborhood’s individual’s velocity during evolution iteration . The following is how cohesiveness is assessed: Here, displays the location of the current individual with index in the evolution iteration , indicates the location of the individual in the neighborhood in the evolution iteration , and is the number of neighbors. The following factors determine attraction to the food source: In this case, indicates the current an individual’s location with index i in the evolution iteration , and is the location of the food source, which is the best-found answer and yield from the current evolution iteration, i.e., . The following is how enemy distraction is identified: whereas is the adversary location that is revealed from the current evolution iteration, i.e., , and is the worst-found solution, displays the current individual’s location with index i in the evolution iteration t. Five presumptive patterns are synthesized to describe dragonfly ways. Two vectors are identified in order to duplicate the movements of fake dragonflies and update their position inside the search space: step length and location. The stage, also known as the step length, is similar to the velocity vector used in the Particle Swarm Optimization (PSO) method, which is the source of the dragonfly algorithm. This stage, also known as the velocity vector, is defined as follows and shows the dragonflies’ direction of travel: Here represents the separation coefficient, while denotes the separation degree of the individual in evolution iteration The alignment coefficient is indicated by , with signifying the alignment of the individual. The cohesion coefficient is represented by , and refers to the cohesion of the individual. A food component is represented by , where represents the food source linked to the individual. is the enemy factor, while denotes the ith individual’s adversary. stands for the inertia weight, while displays the algorithm’s iteration counter. The position vector is calculated using the following equation after the step vector has been calculated: Here, is the algorithm’s iteration counter. by the optimization process, several exploratory and exploitative behaviors can be carried out by the application of parameters like separation , cohesion , food , alignment , and enemy . The best and worst solutions found throughout the entire swarm are used to determine the location of the opponent and the position of the food supply. This technique encourages divergence from less desired locations in the search space while facilitating convergence towards potential sites. When no feasible solutions are nearby, the artificial dragonflies must traverse the search space with a random stride length in order to improve their random or stochastic behaviors throughout the exploration phase. In these cases, the following criteria are used to update the dragonflies’ location: Here, displays the location vector’s dimensions, and indicates the current iteration number. is calculated using the subsequent methods: Here, represents a constant integer, and and are two random numbers between 0 and 1. The following formula is used to calculate : Here in: LEA exploitation stage The extraction step of the proposed technique is local pollination, also known as self-fertilization. The size of the growing area around the best-performing bloom is determined by a coefficient in this procedure. Other solutions travel in the direction of the best-found solution, which acts as a reference point. The movement algorithm takes greater steps at first, then progressively shortens them as it comes to an end. Here shows the position of the pollen during the iteration while illustrates the optimal pollen position identified through all previous evolutionary iterations. shows the area of growth, which diminishes as the algorithm progresses. Initially, the movement steps are more extensive, gradually decreasing in length as the algorithm approaches its conclusion, ultimately converging towards the optimal solution. Here, stands for the algorithm’s current evolution iteration, and for the maximum number of iterations. The values of during the exploration and exploitation phase and the neighbourhood radius of dragonflies during the exploration stage are used in the proposed approach. While the variable is adjusted according to the number of algorithm iterations, controlling the change from longer to shorter movement steps, the dragonflies’ radius is an incremental value that promotes their cohesiveness. LEA exploitation stage reinforcement Using water droplets, a local search is thought of as a way to mimic the flow of water across the Latus flower’s leaves. These drips fill the first pits on the leaf as they are guided towards them, causing water to overflow from the leaf’s surface. Every individual in the swarm is called a drop. has a position and an initial velocity , that it uses to navigate the issue solution space and find the best solution. A drop is placed at the closest local optimum, or pit, when it is first placed on the leaf. Each pit’s fitness is shown by how many drips it can store, which varies with depth. In each iteration, the deepest pit is considered the most valuable pit, with the highest fitness. In the context of local search modelling, each drop is given a velocity vector, whose initial value is derived from the input length of the primitive step. The movement vector sums up to its velocity vector after each iteration. After that, the velocity is added. The input is used to determine the coefficient as these stages is repeated times. According to this paradigm, the depth of each pit affects its capacity, with deeper pits having larger capacities. In every iteration, the total capacity of all pits is calculated as follows: where, stands for pit I’s capacity during the evolution iteration. The size of the ith pit at the same iteration is indicated by t, , the size of the pit with the highest fitness is shown by , and the size of the pit with the lowest fitness is indicated by . For a given objective function, the maximum pit capacity is defined by the constant value Const. There are five pits in the algorithm’s first execution cycle. Each pit’s capacity is increased based on the average of the pits. Any pit that has more water than it can hold is not taken into account further, and the extra water runs off onto the leaf surface. The original iteration’s overflow of water from two pits with limited capacity and the discovery of a pit with additional space. The overflow is directed towards a pit that is larger than the overflowing reservoir. The selection of this pits occurs randomly from the existing pits that have a higher capacity, with the selection process favoring pits with greater capacities. Equation (22): where is the likelihood of selecting a pit during evolution iteration is the capacity of the ith pit at the same iteration t, and k is the total amount of pits with an additional ability than the overflowed pit. After choosing a pit, the surplus water flows in its direction. If, while moving, the water comes into contact with a pit that has a larger capacity than the source pit, the overflowing water is moved into the higher-capacity pit, and the movement then stops. It keeps getting the overflowing water unless there are additional circumstances. At the end of the movement, it is removed. Greater capacity pits are more likely to be reused during algorithm execution because they won’t be removed, so they are more often selected to catch overflowing water that is directed at them. Unlike the PSO method, the particles (drops) in this procedure don’t remember the optimal location found during the search. For each individual drop, no information about the best options is retained. Every drop is able to determine where other drops are right now, and the best drop’s location is always available. While relation (24) shows the velocity and location of the drops as they overflow from a pit on the surface, Eq. (23) shows the drops’ velocity and location during the local search. In relations 16 and 17, indicates the present one velocity of drop i at iteration t, whereas indicates the current location of the deepest pit during the deeppit evolution iteration . The current position of drop at iteration t is denoted by , while the speed increase component is denoted by . Within this iteration framework, two interactions occur among the drops as they assess their competency and fitness criteria to enhance the overall swarm experience (the deepest pit): 1.a pit that is a candidate to receive overflow water from other pits (symbolized by a drop), and 2. The enhancement of drops’ aptitude. Upgraded Lotus effect optimization algorithm In some cases, if the Lotus effect optimization algorithm converges too fast, performance of the results are adversely affected. To solve this problem, this study has proposed two novel techniques. The first method is based upon Chaos theory, modeling it as a discrete-time dynamical system to search for alternative options. The chaos introduced by the chaotic elements allows the optimizer to get freed from the local optima and keep searching for a better solution, in other words, The logistic map was used as the chaos mechanism in this improvement. This mechanism is a simple, efficient way to mimic a chaotic behavior. It utilizes a recursive formula that only employs a single parameter to display a multitude of patterns that can be relatively complex and appear unpredictable, helping with the implementation aspect as it can easily be seen in code. Sensitivity to initial conditions is a property of chaotic systems, and the logistic map exhibits this. The logistic map is a good way to explore, very rapidly, a wide space of solutions as tiny shifts in starting values create wholly different outcomes. Thus, by implementing the logistic map into our work, we get: where, is the number of system generators, is a constant and 3 is the typical value, is the number of iterations, is the number of populations, is the chaotic iteration value. The initial individual () is a random value in interval (0,1). Replacing the updated local search formula by using the logistic map in our work is modified as: The second enhancement of the algorithm, which is used in this study, is based on Lévy flight (LF). Although the LF is highly used in various algorithm modifications, it is one of the most popular improvements. This part updates the former levy mechanism as follows: where, is the Gamma function, is modified as step size, is the index of the Lévy flight which is in a range between zero and two, and have uniformly distributed normally with zero mean and variance. This algorithm is applied to the MnasNet to improve its efficiency for both feature extraction and patch generation. Feature extraction based on MnasNet/ULEO The next step is to pre-train MnasNet on a large-scale dataset, e.g., ImageNet. The network is thus initially trained on large batches of arbitrary images, continuously reading images into memory, and learning pattern representations from unrelated images, creating a well-informed foundation for feature extraction. We then personalize MnasNet for the task of crack recognition through the fine-tuning of the network with Crack500 dataset, consisting of images of cracks. During the fine-tuning stage, the network adapts its weights and biases to identify features specific to cracks, thereby enhancing its performance for the intended application. Now let us break into layer selection, where we choose feature maps from intermediate layers of MnasNet. Figure 8 shows the pipeline of feature extraction based on the suggested technique. The pipeline of feature extraction based on the suggested method. These intermediate layers represent different forms, starting from low-level edges and contours to high-level textures and shapes. Such hierarchical feature learning is important for accurately detecting cracks that can have various types of appearance. The selected layers of Dynamic Feature Extraction then return feature maps that are the output of our feature extraction process. These feature maps essentially “spotlight” areas of high significance in the input image, focusing on where a crack is likely to be. Using the power of MnasNet in learning multi-scale features, we can be able to better identify and localize cracks that can accurately improve the performance of our crack detection. Patch processing The extracted features are used to measure the relevance or complexity of patches. A metric is introduced that captures the extent of complexity in a patch using intensities of the features as follows: where is the patch, and are their dimensions and is the feature intensity at pixel This importance metric is then followed to dynamically modify the size and shape of individual patches, using smaller patches to capture high-complexity regions (e.g., sophisticated crack configurations), and using putatively larger patches for low-complexity regions (e.g., uniform background). This ensures that the network has sufficient detail to correctly capture the cracks for detailed running analysis. A sliding window algorithm with a variable stride is applied to take samples from overlapping patches. A step size (stride) which is based on the patch size controls overlap, specifically this method guarantees that cracks that cross several patches are not overlooked, and the image is completely covered. After the patch sizes and strides have been established, it is time to partition the image into patches. Sliding the window all over the image yields a patch set: where, is the input image, and are coordinates of the patch top left corner. Then, the fine-tuned MnasNet receives each generated patch for crack detection. The preprocessed patch is then fed into the network which outputs a prediction on whether a crack is present or not. Finally, the results of all patches will be merged to yield the final crack detection map. Finally, the detection results from all patches are combined to form a global crack detection map D. Figure 9 shows the adaptive patch processing for crack detection. Adaptive patch processing for crack detection. This Map shows the detected cracks all over the image and the location and if it is ridded. Without lose of generality, we can outline a brief description on how using adaptive patch generation can lead to dynamically adjusting the patch sizes and shapes according to the complexity of content so that the crack detection is accurate and efficient. Then, we do inference on features only from MnasNet and the new version borrowing MnasNet features to extract and processes them, creating a highly suggested crack detection system. Results and discussions As a first step and to justify the vision-based crack detection system, we performed extensive simulations and experiments. Using the Crack500 dataset, we evaluated the effectiveness of our approach in different terms32. The adaptive patching approach was coupled with the optimized hyperparameter model MnasNet and applied to the method. The dataset for analysis was divided into training and testing sets, using an 80–20 split. The evaluation process was done only by means of MATLAB-R2019a in a Windows 11 personal computer. This computer had an Intel® Core™ i7-9700 K processor (2.3 GHz) and 64 GB of total RAM. Following, we include an in-depth breakdown of our simulation setup, results, and a comparative performance on how our approach fares. The Upgraded Lotus Effect Optimization (ULEO) algorithm was used in the optimization process to optimize a few important hyperparameters of the MnasNet architecture. The hyperparameters that were optimized were the learning rate, batch size, momentum, dropout rate, and epochs. The learning rate was also searched over the interval [0.0001, 0.1], and a log scale was used, so that finer exploration of smaller values was performed, which tend to be the best on deep learning models. The batch size was tested to be 16, 128, with a trade-off in memory usage and the accuracy of gradient estimation. Momentum, which was a very essential parameter in convergence of stochastic gradient descent (SGD), was also tuned in the range of 0.5 to 0.99. Between 0.2 and 0.5, the dropout rate that prevents overfitting by shutting down neurons in training was searched. Lastly, the epochs were restricted to the interval of [50, 200], which gave the model time to learn without spending too much time training. These hyperparameters were searched using values that were known to be optimal when used in similar tasks, and the surveys carried out previously. A combination of criteria was used to decide the termination of the ULEO algorithm with the aim of achieving convergence and efficiency in computing. The optimization process was to be stopped upon any of the following conditions being met: (1) the performance index (a weighted sum of the accuracy and efficiency measures) improved by a factor less than 0.1 percent over 10 consecutive iterations, meaning that the algorithm had probably arrived at a good or near-optimal solution; (2) the maximum number of iterations, which was 100, had been reached thus ensuring that the optimization process was not made excessively time consuming. The underlying intent of selecting these termination criteria was to balance a trade-off between the desirability of the hyperparameter space being fully explored and practical considerations of computation. The use of ULEO under these particular settings for hyperparameters, search ranges, and termination criteria allowed the optimization to effectively explore the complex hyperparameter space and lead to the highly-tuned MnasNet model with the potential of dramatically increasing the accuracy and efficiency of crack detection in civil infrastructure. In order to allow reproducibility and clarity, the adaptive patching strategy used in this work establishes particular parameters in patch generation such as patch size, stride, and overlap. The patch size was chosen automatically according to the complexity of the image, 32 × 32 pixels in strongly detailed areas, 64 × 64 pixels in medium complexity areas and 128 × 128 pixels in less complex areas to trade-off between accuracy detection and processing efficiency. A variable stride algorithm was used, where stride values were 16, 32 and 64 respectively and a full overlap of 50 percent between patches was maintained. Such overlap guaranteed the easy capture of cracks that cut across several regions without incurring huge computations. The final parameters selected after the long period of experimentation were able to provide the best trade off between accuracy and efficiency and therefore the proposed method is very suitable in terms of mobile and embedded implementation into real time crack detection system. Reproducibility In order to make the ULEO algorithm experienceable to the MnasNet architecture in the crack detection context, one would have to connect the mathematical formulations (Eqs. 8–29) to the details of implementation. The ULEO algorithm proceeds with the exploration phase in which the principles of separation, alignment and cohesion (Eqs. 8–10) of the dragonfly algorithm are applied using NumPy library in MATLAB and the search is done based on the computed velocity vectors. Such calculations are made in the form of a nested loop format wherein the outer loop is a repeat over the number of generations and the inner loop is a repeat over the population size. The separation, alignment and cohesion vectors are computed in each individual of the population and their weighted sum (Eq. 11) provides the step vector (Eq. 12) which is applied in updating the position of each individual (Eq. 13). At the exploitation stage, the local pollination (Eq. 14) is applied by the same loop structure, in which the update of the position of each pollen (solution) is applied to the solution with the best solution (Eq. 15). The growth area coefficient (Eq. 16) is dynamically adjusted via a decay function that has the effect of reducing its value with increasing number of iterations thus making sure that the search process shifts smoothly between exploration and exploitation. To ensure the extraction step is reinforced, the Levy flight mechanism (Eq. 17) is utilized, taking the place of the Levy distribution, which is sampled via the MATLAB library LevyFlight to ensure that no premature convergence occurs. The chaotic exploration, which is proposed by the logistic map (Eq. 18) is executed as follows: The chaotic exploration is initially seeded with a random number, and the chaotic iteration value (Eq. 19) is updated sequentially by means of the logistic function. It is a chaotic term that is incorporated in the position update step (Eq. 20) to improve exploration of the search space. A priority queue data structure is used to implement a model of the pit capacity (Eqs. 21–24) as a way of making efficient modifications and updates to the capacities of various pits depending on their depths. Selection of pits that overflowing water (Eq. 25) will be done through a weighted random selection process, meaning that the pits with higher capacity have higher chance of being chosen. The combination of these mathematical expressions into the Python implementation has made the ULEO algorithm to run as per the specifications, with every part of the algorithm working towards the overall optimization process. With such a comprehensive connection between the theoretical and practical aspects of the implementation of the proposed approach to the crack detection in civil infrastructure, we expect to empower researchers and practitioners to replicate and expand on the proposed approach to the crack detection in the civil infrastructure. The pseudocode of the proposed model is given in Algorithm 1. Pseudocode for the model workflow. Model optimization The results of optimising the hyperparameter selection using the proposed algorithm and two other metaheuristic methods, namely Particle Swarm Optimisation (PSO) and Genetic Algorithm (GA), are presented in the next section. The best hyperparameter values found, together with their corresponding performance index values, are displayed for each algorithm after it has been run multiple times using different random seeds. The table below demonstrates the optimum variable values obtained for this study (see Table 1). Table 1The optimum variables value trained for this study.HyperparameterGA (Best)PSO (Best)SA (Best)Learning rate ()0.00100.00150.0013Batch size ()64128190Number of epochs555560Weight decay ()0.00030.00040.0005Momentum ()0.80.900.92Dropout rate ()0.30.240.21Performance index value ()0.6210.5830.625 The optimum variables value trained for this study. While Particle Swarm Optimization (PSO) and ULEO also found effective hyperparameter configurations that resulted in somewhat higher performance index values, the Genetic Algorithm (GA) generated the smallest total performance index value of 0.621 with the given hyperparameter settings. The need of examining different solution spaces was highlighted by the optimizers’ differing optimum hyperparameter values. To strike a balance between model capacity and regularization, a variety of initialization techniques and data augmentation approaches have been used, demonstrating their impact on the optimization process. The rate of dropout has also been modified. The simulations’ results provide useful information about the best hyperparameter selection for MnasNet using various optimizers, and the table shows the best configurations found, allowing a comparison of the algorithms’ effectiveness and impact on the performance index value. GA, PSO, and ULEO are particularly effective at determining the best hyperparameter for MnasNet (see Fig. 10). The accuracy and loss convergence. More specifically, this table displays the accuracy and loss values tracked at every ten iterations for the three methods, allowing a granular observation of how the proposed MnasNet/ULEO method performs against MnasNet/GA and MnasNet/PSO as far as convergence and more generally in accuracy is concerned. As can be observed, the performance of MnasNet/ULEO is superior to the other two variants, with the best accuracy (95.2%) and loss (0.249) at iteration 100. While the results for MnasNet/GA and MnasNet/PSO also improve, they do so to a lesser extent, ending up with 91.8% and 93.0% accuracy respectively, along with higher loss values. In conclusion, we find that ULEO produces the best optimization results, however all three techniques produce stable and meaningful performance improvements as time progresses. Measurement indicators This paper employs different measures to assess the productivity of the suggested technique. The measure contains accuracy, specificity, F1 score, Matthew’s correlation coefficient (MCC), and sensitivity33. Following formulations present the mathematical equations for these measures: Here, FP and FN stand for False Positive and False Negative, respectively, whereas True Positive describes TP and True Negative indicates TN. Comparative analysis The method efficiency has been analyzed based on the measurement indicators. This section provides conducted twofold, threefold, and fivefold cross-validation and compared the method results with the outcomes of some advanced methods, containing OpenMV Cam H7 Plus1, CNN2, VGG163, XAI/t-SNE4, and XGBoost5. Table 2 illustrates the 2-Fold Cross-Validation. Table 22-twofold cross-validation.MethodAC (%)ST (%)PC (%)SP (%)F (%)MCCOpenMV Cam H7 Plus82.480.378.684.279.465.2CNN88.786.985.490.186.174.7VGG1691.289.887.992.588.877.9XAI/t-SNE87.485.683.589.084.572.3XGBoost90.188.586.291.887.376.5Proposed MnasNet/ULEO95.694.593.796.394.190.5 2-twofold cross-validation. Table 2 compares several crack detection methods using twofold cross-validation. The results indicate that our novel MnasNet/ULEO model presenting the highest accuracy of 95.6%, sensitivity of 94.5%, precision of 93.7%, specificity of 96.3%, F1-score of 94.1% and MCC of 90.5%, in comparison with traditional species identification methods, included OpenMV Cam H7 Plus, CNN, VGG16, XAI/t-SNE, and XGBoost. The results show that our procedure perform well on detecting the cracks with lesser false positives and false negatives. The high specificity reflects the reliability of crack detection in non-crack areas, indicating that when the model predicts a non-crack area, it corresponds to a true negative, thereby minimizing false positives in the detection process. Table 3 illustrates the 3-Fold Cross-Validation. Table 3The threefold cross-validation.MethodAC (%)ST (%)PC (%)SP (%)F (%)MCCOpenMV Cam H7 Plus83.181.279.785.080.466.3CNN89.487.786.090.786.875.6VGG1692.190.588.593.389.478.9XAI/t-SNE88.086.384.289.585.273.0XGBoost90.789.186.792.287.977.3Proposed MnasNet/ULEO96.295.194.397.094.791.3 The threefold cross-validation. The performance metrics on the Table 3 are calculated using the threefold cross-validation. The proposed MnasNet/ULEO model outperforms existing methods on every tested metrics. The accuracy at the moment of the model was 96.2%, sensitivity 95.1%, precision 94.3%, specificity 97.0%, F1-score reached 94.7% and MCC achieved 91.3%. These results add further validation for the reliability of the proposed approach in complex, challenging scenarios. Higher specificity value of 97.0% with respect to the twofold cross-validation signifies that our model has a better ability to differentiate between crack and non-crack regions, thus minimizing the false positive rate. Table 4. illustrates the 5-Fold Cross-Validation. Table 4The fivefold cross-validation.MethodAC (%)ST (%)PC (%)SP (%)F (%)MCCOpenMV Cam H7 Plus84.282.180.486.181.267.5CNN90.188.486.791.387.576.7VGG1693.091.289.094.090.180.0XAI/t-SNE88.687.084.890.285.973.8XGBoost91.490.087.492.788.778.2Proposed MnasNet/ULEO97.196.095.297.895.692.0 The fivefold cross-validation. Results of the crack detection methods with fivefold cross-validation are presented in Table 4. In our model of MnasNet/ULEO, we have the best performance across all metrics as follows; accuracy: 97.1%, sensitivity: 96.0%, precision: 95.2%, specificity: 97.8%, F1-score: 95.6%, and MCC: 92.0%. This approach achieves state-of-the-art results in primavera and effective discovery method as the adaptive passing and hyperparameter search for crack detection. A high specificity value of 97.8% demonstrates the model’s capability of detecting the non-crack region accurately which avoids false alarms and offers good reliability in crack detection. Despite the difference in cross-validation setups, our method still provides the best and most stable results compared to the other techniques. Convergence behavior of training loss and accuracy To evaluate the optimization efficiency of the Upgraded Lotus Effect Optimization (ULEO) algorithm, the training loss and accuracy across 100 epochs were recorded and visualized. Figure 11 shows training accuracy convergence analysis for MnasNet with ULEO. Training accuracy convergence analysis for MnasNet with ULEO. The convergence analysis clearly demonstrates the superiority of the ULEO-optimized MnasNet over GA and PSO in terms of both speed and final accuracy. The ULEO variant achieves 95.2% accuracy by epoch 100, significantly outperforming GA (91.8%) and PSO (93.0%). This rapid and stable convergence is attributed to the chaotic exploration and Lévy flight mechanisms embedded in ULEO, which prevent premature convergence and enhance global search capability. The smooth progression of the ULEO curve indicates effective balancing between exploration and exploitation, enabling the model to escape local optima and steadily improve feature representation. In contrast, GA and PSO exhibit slower learning curves, suggesting limitations in navigating the hyperparameter space efficiently. This result validates the effectiveness of the upgraded optimization strategy in tuning critical parameters like batch size, learning rate and momentum ultimately leading to a more robust crack detection model. Confusion matrix visualization for fivefold cross-validation True positives, false positives, true negatives, and false negatives are all broken down in depth in a confusion matrix. It simulates a confusion matrix for the suggested MnasNet/ULEO model using the fivefold findings. The suggested model’s remarkable classification ability, especially in reducing false negatives and false positives, as demonstrated by the confusion matrix. With 478 true positives and only 22 false negatives, the model demonstrates high sensitivity, ensuring that most actual cracks are correctly identified-a critical requirement for structural health monitoring. Figure 12 shows the confusion matrix for the MnasNet/ULEO in 5-Fold cross-validation. Confusion matrix for MnasNet/ULEO in 5-Fold cross-validation. Strong specificity is also demonstrated by the low false positive count (11) and high true negative count (613), which indicate that the model hardly ever incorrectly labels intact surfaces as fractured. Practical deployment requires striking a balance between sensitivity and specificity because undetected cracks might jeopardise safety and false alarms can result in needless maintenance expenses. The visual gradient in the matrix further emphasizes the dominance of correct predictions, reinforcing the model’s reliability. The integration of adaptive patching and ULEO-based optimization contributes to this performance by enabling fine-grained feature extraction and robust decision boundaries. Receiver operating characteristic (ROC) curve analysis At different threshold settings, the ROC curve assesses the trade-off between the true positive rate (sensitivity) and false positive rate (1—specificity). Figure 13 shows the ROC Curve for MnasNet/ULEO Model. ROC curve for MnasNet/ULEO model. With an estimated AUC of 0.987, the ROC curve shows the model’s exceptional discriminative capability across a range of classification thresholds, demonstrating nearly perfect separation between cracked and uncracked classes. A robust classifier is characterised by high sensitivity and a low false positive rate, as indicated by the curve that hugs the upper-left corner of the plot. Even at low thresholds (e.g., 0.1), the true positive rate remains above 98%, while the false positive rate stays below 15%. This behavior is particularly advantageous in safety–critical applications where missing a crack is more costly than a false alarm. The high AUC value further confirms the effectiveness of the ULEO-optimized hyperparameters and the hierarchical feature extraction of MnasNet in capturing subtle crack patterns. The model’s ability to maintain performance across thresholds underscores its adaptability to different operational environments and inspection requirements. Patch-wise detection probability distribution To analyze the spatial distribution of crack predictions, we generate a heatmap showing the probability of crack presence across image patches. Figure 14 illustrates the patch-wise crack detection probability map. Patch-wise crack detection probability map. The patch-wise probability map illustrates the extent to which the adaptive patching strategy can correctly locate cracks with spatial precision. The model assigned high probabilities to central patches (> 0.9) corresponding to where simulated cracks exist, whereas peripheral areas were assigned low probabilities since the surface was intact. This spatial coherence confirms that the model does not simply produce isolated false positives but rather recognizes continuous crack structures. The gradient fall-off in probability around the crack edges is an indicator of the model’s confidence calibration and suggests its capacity to deal with partial or faint cracks. Variable-sized patches with overlapping strides have been used and ensure that no crack segment is missed, even when it cuts through multiple patches. It underscores the complementarity of the MnasNet backbone with ULEO-optimized decision logic, which allows accurate and reliable pixel-level localization of cracks salient specification demanded by any automated structural inspection system. Broader application in different sectors The wide applicability of our proposed crack detection system, as both general-purpose and specialized, goes beyond construction and infrastructure maintenance (see Fig. 15). Diverse applications of technology. Overall, an image-based crack detection method with suitable accuracy, generalization efficiency on different materials, images and surfaces is significant for many industries, especially material shows cracking behavior. Ablation studies In order to adequately assess the effects of every part of the suggested MnasNet/ULEO framework, we performed an ablation study set. These experiments were aimed at separating the influence of MnasNet fine-tuning, ULEO optimization, adaptive patching, and preprocessing to the performance in detecting cracks. 1.MnasNet Fine-Tuning: First, we tested the performance of a pre-trained MnasNet model without fine-tuning on Crack500 dataset. The model had an accuracy of 85.3 which means that it was at the level of its baseline in identifying crack patterns. Nevertheless, on the Crack500 context, with further fine-tuning, the precision increased to 92.1, which proved that domain specific fine-tuning is essential in improving the accuracy of the model in detecting cracks. 2.ULEO Optimization: We now looked at the ULEO optimization effect on the fine-tuned MnasNet model. In the absence of ULEO, the model had an accuracy of 92.1 as mentioned earlier. Nevertheless, the accuracy has reached 95.2 when ULEO has been utilized to optimize the hyperparameters. This enhancement indicates that ULEO can be used effectively to optimize important hyperparameters, including the learning rate and the size of the batch, that can be very important in optimizing the performance of the model. 3.Adaptive Patching: To examine the role of adaptive patching, comparison between the role of the model with and without adaptive patching was used. The no adaptive patching, fixed-size patch model realized an accuracy of 93.4. Conversely, the adaptively patching model raised accuracy to 95.2 in the case of dynamically changing patch sizes according to image complexity, which reveals the advantages of dynamically changing patch sizes according to the complexity of the image. This finding supports the significance of adaptive patching to enhance the spatial sensitivity and accuracy of crack detection. 4.Preprocessing: Lastly we also analysed the influence of preprocessing methods, like contrast enhancement and noise reduction, on improving the quality of the input image. The model that was trained on raw images was not preprocessed and had an accuracy of 90.5%. But with preprocessor techniques, the benchmark was raised to 95.2 which shows the importance of preprocessor in enhancing the power of the model to obtain significant features in the input images. Overall, the ablation experiments show that every element of the MnasNet/ULEO framework plays a significant role in the performance of the crack detection system on the whole. MnasNet fine-tuning fine-tunes the model to detect crack patterns, ULEO optimization fine-tunes important hyperparameters, the adaptive patching enhances spatial sensitivity and preprocessing methods guarantee quality input data. The joint performance of these two components leads to a powerful and efficient crack detection system with the state of the art performance. Sensitivity analysis The sensitivity analysis was performed in detail and assessed the strength of the proposed MnasNet/ULEO framework of crack detection toward changes in learning rates, classification thresholds, and environmental conditions. The experiment found that a learning rate slower than 0.001 brought about slow convergence whereas a learning rate faster than 0.01 brought about instability; the learning rate of 0.005 was the best performance and maintained a balanced performance. Through threshold analysis, a value of 0.5 was observed to provide the optimal compromise between sensitivity and specificity with lower values resulting in more false positives and higher values resulting in fewer true detections. Experiments on the environment revealed that the model was highly robust in contrast to different light environments but exhibited moderate performance degradation (reaching about 92 percent) when strong shadows were present or when the surface being tested had strong texture. Altogether, the MnasNet/ULEO model is characterized by medium sensitivity to changes in hyperparameters and environmental factors, and ULEO optimization is effective in overcoming changes in performance. Further development of adaptability to the challenging visual conditions should be considered in the future to further strengthen the applicability in the real world. Computational complexity The MnasNet/ULEO framework has a computational complexity that can be subdivided into a few important components: Preprocessing: Preprocessing: Noise Reduction (Median Filtering): The median filtering has the complexity of: , where is the number of pixels in the image and is the size of the filtering window. Noise Reduction (Median Filtering): The median filtering has the complexity of: , where is the number of pixels in the image and is the size of the filtering window. Contrast Enhancement (CLAHE): CLAHE is a complex method with , where m is the number of histogram bins. Contrast Enhancement (CLAHE): CLAHE is a complex method with , where m is the number of histogram bins. 2.Adaptive Patching: Adaptive Patching: The adaptive patching process is complex depending on the number of the patches generated. If the image is divided into patches, the complexity is . The adaptive patching process is complex depending on the number of the patches generated. If the image is divided into patches, the complexity is . 3.MnasNet Inference: MnasNet Inference: The MnasNet architecture is meant to be small, with a complexity of computation of less than. per layer, where is the number of channels, is the kernel size, and is the spatial dimension of the input feature map. For the entire network, the complexity is , where is the number of layers. The MnasNet architecture is meant to be small, with a complexity of computation of less than. per layer, where is the number of channels, is the kernel size, and is the spatial dimension of the input feature map. For the entire network, the complexity is , where is the number of layers. 4.ULEO Optimization: ULEO Optimization: The complexity of the ULEO algorithm is. , where is the number of iterations, P is the population size, and F is the complexity in measuring the fitness function namely the MnasNet inference. The complexity of the ULEO algorithm is. , where is the number of iterations, P is the population size, and F is the complexity in measuring the fitness function namely the MnasNet inference. Why crack classification was selected over segmentation? Considering the remark on the selection of a crack classification approach as opposed to the crack segmentation approaches, it can be explained why such decision was made, as well as the limitations perceived by them. Although the crack segmentation methods, including SDDNet and STRNet, can offer detailed pixel-level details about the morphology of cracks, our suggested classification-based method has a few unique benefits, which would be highly applicable to the unique needs of automated crack detection in civil infrastructure. The computational efficiency of a classification-based approach is one of the main reasons why the approach was selected to be used, and in the subject it is essential to have computational efficiency as real-time execution. Although the crack segmentation techniques are more information rich, they are usually comparatively more computationally intensive since they require processing on a pixel by pixel basis, making them difficult to implement on resource limited systems (e.g., mobile platforms or embedded systems) where real-time processing is necessary. Conversely, MnasNet/ULEO framework which emphasizes on classification is a lightweight and efficient framework that can be implemented on these devices without performing any tradeoffs on the performance of the framework where speed and reliable crack detection is a priority, which makes it very suitable in on-site inspection and real-time monitoring. Also, in general, the methods of crack classification are less sensitive to the environmental changes, including lighting, shadows and the surface textures, than the methods of segmentation. It is due to the fact that classification is aimed at determining the existence of cracks and not specific locations, which may be more prone to noise and image quality variations. Our approach to the classification proves to be very resilient to various environmental conditions as it is based on the adaptive patching strategy and the ULEO-optimized hyperparameters, so we can be confident that our methodology detects the cracks in difficult environments. Although it is fair that the classification techniques need an extra procedure in order to measure the cracks identified, it can be managed and simplified. The spatial distribution and density of predictions of cracks can be used to quantify cracks and this can offer important information on how severe and extensive a damage is. The adaptive patching strategy using variable patch sizes and overlapping strides makes it easy to accurately localize cracks, which in turn is required to determine the number of cracks. The use of ULEO further, provides optimality of the model parameters in both detection and quantification activities, and as a result, reduces the constraints encountered in the supplementary quantification process. Despite being highly developed and efficient techniques of crack segmentation, which offer detailed information at the pixel level, SDDNet and STRNet possess some drawbacks, i.e. high requirements of the computational resources and vulnerability to the changes in the image quality and environment factors. On the contrary, the MnasNet/ULEO framework is a more intuitive solution since it gives a compromise between computational and robustness as well as applicability to real time which offers a dependable and efficient crack detection method that fit well to the practical requirements of infrastructure monitoring. Realizing that it is quite possible that adding segmentation functions might contribute to the system, future studies may investigate the possibility of adding segmentation methods to the MnasNet/ULEO framework to allow the system to offer detection and morphological detail information, and thereby make the system even more useful in structural health monitoring. To sum up, the process of identifying cracks is best represented by the classification-based strategy due to its computational efficiency, robustness and ability to be applied in the real-time. Although the extra quantification step is a weakness, it can be addressed successfully by using the adaptive patching and ULEO optimization tools which we have utilized in our study and thus MnasNet/ULEO framework is a viable and workable tool in automated crack detection and as an alternate solution to more computationally intensive segmentation schemes. Discussions MnasNet/ULEO framework was developed keeping the major trade-offs in mind to provide a balance between efficiency and performance with automated crack detection. There is a major trade-off between convergence rate and accuracy in which ULEO is balanced in convergence rate because it employs chaos theory and Levy flight dynamics, at the expense of global search capability to avoid premature local optima. The balance enables the framework to obtain fast optimization as well as a high degree of accuracy which is critical in real time structural monitoring. There is one more important trade-off that is the issue of computational overhead and performance. Even though ULEO presents computational complexity, this is balanced with implementations, adaptive patching which focuses resources on complex parts and lightweight design of MnasNet, which makes the model mobile and embedded deployable. In general, through careful trade-off management, the MnasNet/ULEO framework provides a strong, precise and efficient solution to application in real-world crack detection. The MnasNet/ULEO framework was designed with careful consideration of key trade-offs to balance efficiency and performance in automated crack detection. A primary trade-off exists between convergence speed and accuracy, where ULEO’s integration of chaos theory and Lévy flight dynamics accelerates convergence while maintaining global search capability to prevent premature local optima. This balance allows the framework to achieve both rapid optimization and high accuracy, essential for real-time structural monitoring. Another critical trade-off concerns computational overhead versus performance. Although ULEO introduces some computational complexity, this is mitigated through efficient implementation, adaptive patching that concentrates resources on complex regions, and the lightweight design of MnasNet, ensuring the model remains suitable for mobile and embedded deployment. Overall, by effectively managing these trade-offs, the MnasNet/ULEO framework delivers a robust, accurate, and resource-efficient solution for real-world crack detection applications. The appearance of the algorithm of the Upgraded Lotus Effect Optimization (ULEO) in the sphere of structural health monitoring (SHM) is the important step, as the algorithm has the peculiar feature of overcoming the shortcoming of the conventional optimization methods. The dynamics of chaos theory and ability to explore hyperparameter space through ULEO is more efficient and is essential to fine-tuning complex models such as MnasNet. As opposed to traditional algorithms, ULEO exhibits a higher convergence rate and has a higher capacity to escape local minima, a trap of hyperparameter optimization. This is of special significance in SHM, wherein precision and dependability of the crack is chief. The chaotic exploration stage of ULEO allows to search more widely among the possible solutions, the mechanism of a Levy flight can guarantee that the search does not occur locally in small areas of search, improving the global search. Moreover, adaptive patching strategy, together with ULEO, can be used to dynamically adjust the patch size depending on the complexity of the image, thus, in a manner that the maximum amount of macro and micro-cracks is detected without reducing processing speed. Such a set of features makes ULEO a perfect candidate to SHM applications, where the tradeoff between the accuracy of detection, and the efficiency of computation is essential. Utilizing these benefits, the MnasNet/ULEO system provides a new standard of lightweight hyperparameter-optimized crack detection systems in civil infrastructure. In another side, the concept of adaptive patching comes in with a new concept of crack detection: it adapts patch sizes to the complexity of the image content, an aspect that is absent in the classic patch-based techniques that are commonly used in SHM and computer vision. In the traditional patch-based methods, the picture is split into all-sized patches, which may be inefficient and inaccurate, particularly with cracks that are of different sizes and shapes. As an example, small patches can not capture the width of large cracks, and large patches can reduce the complexity of small cracks, resulting in possible confusion between them. Contrastingly, our adaptive patching framework uses the complexity measure to determine the content of each region in the image, enabling them to use smaller patches in highly complex regions (e.g. complex crack patterns) and larger patches in low-complex regions (e.g. uniform backgrounds). This dynamic variation guarantees that the network can be provided with adequate detail to properly identify cracks of any size with a minimum of computational redundancy. Moreover, the adaptive patching method is synthetically combined with the MnasNet/ULEO framework, in which the refined hyperparameters and the unstructured exploration of ULEO contribute to the model learning and generalizing to the diverse patch sizes. This integration is essential because it enables the model to be very accurate and efficient within the range of various scales and complexities of cracks. Also, a sliding window with a varying stride is used to make sure that no cracks between multiple patches are missed, which additionally contributes to the strength of the detection procedure. Adaptive patching addresses the weaknesses of fixed-size patching and does not only enhance the spatial sensitivity of crack detection, but also balances the detection accuracy and computational cost in a favorable way, thus it is specifically useful in application in mobile and embedded environments. Conclusions Traditional image processing techniques (IPTs) to crack detection have been used to serve as an alternative to human-conducted onsite inspections. While helpful, these IPTs struggle with different scenarios seen in the real world and different types of cracks. In this study, we proposed a vision-based method for detecting cracks by applying MnasNet. Through an enhanced version of genome reproduction optimization, the method was capable of fully extracting hyper parameters of MnasNet, in turn avoiding the tedious feature extraction process challenged by classical methods. The proposed MnasNet/ULEO framework significantly advanced the field of automated structural inspection, offering the first implementation of ULEO in civil infrastructure monitoring and establishing a new benchmark for lightweight, hyperparameter-optimized crack detection. By chaos theory and Lévy flight dynamics, ULEO permitted a more effective exploration of the hyperparameter space with faster convergence and better model performance (97.1% accuracy, 97.8% specificity) compared to GA or PSO. Meanwhile, adaptive patching further improved spatial sensitivity, permitting good detection of micro-cracks without compromising inference speed-making the system fit for deployment on mobile or embedded platforms. This work, in addition to its immediate application, provided a basis for a new class of bio-inspired, self-optimizing vision systems which can be extended to the detection of spalling, delamination, corrosion, and other surface defects of various materials. Further studies will investigate real-time deployment on UAVs and robotic inspectors toward the vision of fully autonomous intelligent infrastructure monitoring networks. Author contributions Kun Li, Feng He, Xiaojun Zhao wrote the main manuscript text. Kun Li, Feng He, Xiaojun Zhao reviewed the manuscript. Funding Yunnan Provincial Market Supervision Administration Science and Technology Plan Project Research on abnormal behaviour recognition method of passengers in lift car based on graph neural network (2023YSJK05) Projects of Yunnan Provincial Science and Technology Department Study on Beyesian for Geohazard risk evaulation in Yunnan (202101AT070562) Project (42062020) Research on the higher precision space–time multivariate collaborative geostatistics models based on physical mechanism supported by NSFC. Data availability The data can be accessible by the following link from Kaggle website: [https://www.kaggle.com/datasets/pauldavid22/crack50020220509t090436z001]. Declarations Competing interests The authors declare no competing interests. Footnotes Publisher’s note Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations. References Associated Data Data Availability Statement The data can be accessible by the following link from Kaggle website: [https://www.kaggle.com/datasets/pauldavid22/crack50020220509t090436z001].