Automatically Designing CNN Architectures Using the Genetic Algorithm for Image Classification

Yanan Sun, Bing Xue, Mengjie Zhang, Gary G. Yen, Jiancheng Lv

Introduction

The success of Convolutional Neural Networks (CNNs) in image classification is largely attributed to the design of sophisticated architectures. However, creating high-performing models like ResNet or DenseNet typically requires significant domain expertise and extensive trial-and-error. This "manual" design process creates a significant barrier for researchers without deep backgrounds in neural architecture. While Neural Architecture Search (NAS) has emerged to automate this process, many existing methods either rely on human-defined templates or demand prohibitive computational resources—sometimes requiring thousands of GPU days.

To address these challenges, this paper introduces CNN-GA, a fully automated approach that leverages genetic algorithms (GA) to evolve CNN architectures from scratch. By utilizing variable-length encoding and efficient asynchronous scheduling, CNN-GA discovers competitive architectures with minimal human intervention and significantly reduced computational costs.

The CNN-GA Framework

The proposed method treats the search for an optimal neural network as an evolutionary process. The algorithm begins with an initial population of candidate architectures and iteratively improves them through selection, crossover, and mutation.

The evolutionary workflow of the proposed CNN-GA algorithm, illustrating the cycle from population initialization to final architecture selection.

A critical component of CNN-GA is its computational efficiency. To make the search feasible on standard hardware, the authors implemented two key acceleration strategies:

  1. Asynchronous Evaluation: Rather than waiting for an entire generation to finish training, individuals are evaluated on GPUs as they become available.
  2. Fitness Caching: The system maintains a hash-based cache of previously trained models. If the evolutionary process generates an identical architecture, its accuracy (fitness) is retrieved from the cache, avoiding redundant training.

Architecture Representation and Encoding

Unlike traditional genetic algorithms that use fixed-length chromosomes, CNN-GA employs a variable-length encoding strategy. This allows the "DNA" of the network to expand or contract, enabling the algorithm to automatically determine the optimal depth for a given task.

Illustration of the variable-length encoding strategy. Each block represents a functional unit, and dotted lines indicate skip connections that facilitate training in deeper networks.

To ensure these deep networks remain trainable, the algorithm incorporates Skip Connection Blocks. Inspired by ResNet, these blocks include shortcut connections that help mitigate the vanishing gradient problem. The genetic operators—specifically a specialized one-point crossover and various mutation operators—are designed to handle these variable-length structures, allowing for the addition, removal, or modification of layers without breaking the network's functional integrity.

Experimental Evaluation

The CNN-GA algorithm was benchmarked on the CIFAR-10 and CIFAR-100 datasets, which are gold standards for evaluating image classification performance.

  • Performance: On CIFAR-10, CNN-GA achieved a top accuracy of 96.78% (using cutout augmentation). This performance surpasses many manually designed models, such as ResNet-110 (93.57%), and is competitive with state-of-the-art NAS results like NASNet-A (97.60%).
  • Efficiency: One of the most striking results is the reduction in search time. While early NAS methods required upwards of 22,000 GPU days, CNN-GA reached its results in just 35–40 GPU days. This represents a roughly 55x improvement in efficiency compared to models like NASNet-B.
  • Model Compactness: The evolved models are notably lean. For instance, on CIFAR-100, CNN-GA achieved 77.97% accuracy with only 4.1 million parameters, whereas a comparable ResNet model required over 10 million parameters to achieve a lower accuracy of 72.18%.

Conclusion and Future Work

CNN-GA demonstrates that "black-box" automated design can produce efficient, high-performance architectures that rival human-expert designs. By integrating skip connections and variable-length encoding into an evolutionary framework, the system effectively navigates the vast search space of possible CNN configurations.

While the reduction to 40 GPU days is significant, it still represents a hurdle for some users. Future research aims to incorporate surrogate models to predict performance without full training, potentially reducing search times to a matter of hours. Additionally, the authors plan to investigate the transferability of these evolved architectures to larger-scale datasets like ImageNet.

Summary updated

BibTeX
@article{sun2020automatically,
  author = {Yanan Sun and Bing Xue and Mengjie Zhang and Gary G. Yen and Jiancheng Lv},
  title = {{Automatically Designing CNN Architectures Using the Genetic Algorithm for Image Classification}},
  journal = {IEEE Trans. Cybernetics},
  year = {2020},
  doi = {10.1109/tcyb.2020.2983860},
}
Figure