Elamur Research

XiNet: Efficient Neural Networks for tinyML

Paper · 2023 · Alberto Ancilotto, Francesco Paissan and Elisabetta Farella

Summary

A camera can ask a small processor to recognize what is in an image, or to locate several objects within it. Before the processor can answer, it must hold the intermediate results of the computation in working memory. It must also finish the work quickly enough to keep up with the intended application. A neural network with few stored weights can still require large intermediate arrays, and a layer with relatively little arithmetic can spend much of its time moving data. XiNet starts from this mismatch between the quantities that are easy to count on paper and the costs that determine whether an image-processing system can run on a particular device.

The authors measure common operations on embedded hardware, using the energy needed by standard convolution for a fixed amount of arithmetic as a reference. A standard convolution combines nearby values across input channels to produce new image features. The depthwise alternative processes each channel separately and uses fewer weights on its own. In the experiments, however, depthwise convolution uses substantially more energy than standard convolution for equivalent arithmetic work. The authors also show why a block built around depthwise convolution can require large temporary arrays if it first expands the number of channels. XiNet turns the sequence around. It compresses the channels before running a standard convolution, and it uses operations with favorable measured or practical properties to implement attention and connections between blocks.

Hardware Aware Scaling lets the designer change the overall width of the network, redistribute channels across its depth, and adjust how much each block compresses its input. These choices affect temporary memory, weight storage, and arithmetic in different ways. The paper tests what can be gained from those choices in image classification on CIFAR-100 and object detection on MS-COCO and VOC-2012. On CIFAR-100, XiNet-Class reaches 72.27% accuracy. It processes 3.40 frames per second at 22.3mJ on the STM32H7A3, and 30.6 frames per second at 165mJ on the Raspberry Pi 4. It is the fastest and uses the least energy per inference among the classifiers in that comparison on both devices. MCUNet in4 has the highest reported accuracy, at 72.86%.

In detection, the authors report a favorable accuracy and complexity tradeoff against small YOLO detectors on MS-COCO. On VOC-2012, they report a 2× reduction in arithmetic operations and a 9× reduction in working memory when scaling XiNet to match a competing detector’s performance. The paper also gives a headline detection result of a 70% reduction in energy requirements at similar performance. The detailed experiments establish different parts of the case. Operator measurements guide the block design, classifier timings and energy measurements show how a complete network runs, and the detector comparisons show what changes when the architecture is scaled to fit different resource budgets.

Deep dive: XiNet: Efficient Neural Networks for tinyML

XiNet uses hardware measurements to design and scale neural networks for image classification and object detection on memory-constrained devices. · about 34 minutes to read

The problem and its context

What has to fit on the device

Running a convolutional network on an embedded processor poses several questions about the same computation. Where will its learned weights be stored? How much working memory must be available at the busiest point in an inference? How long does an input take to process, and how much energy does the device spend processing it? A design can be attractive on one of these dimensions and difficult to use on another. This is the deployment problem XiNet addresses for small devices, including microcontrollers, within the broader effort to distribute processing between edge devices and cloud systems.

The paper distinguishes FLASH from RAM because the two hold different things. FLASH is where a deployed network can store its learned parameters. RAM is where the processor keeps the values it is actively working with. Those values include activations, the intermediate outputs of layers, organized into arrays called tensors. An image feature tensor has spatial dimensions and channels. Each channel holds a map of feature values across the image representation. A layer that temporarily increases the number of channels can therefore require substantial RAM even if its own weights take up little space in FLASH.

The largest tensor offers a clue to peak RAM, but the processor can need several values at once. A layer can need its input while it is writing its output. A connection that bypasses some computation can keep an earlier tensor alive until a later addition. The paper calls this latter path a skip connection. Keeping track of the arrays that coexist makes the memory question concrete. The inference engine, the software that executes the network, also influences how much space those arrays occupy in practice. The authors therefore treat memory comparisons made with a fixed engine as informative about architectural choices.

Arithmetic presents a related problem. A multiply–accumulate operation, or MAC, multiplies values and adds the product into a running result. Convolutions perform many such operations, so a MAC count gives a compact description of how much arithmetic a network requests. It says little about the data movement needed to carry it out. Registers, the small storage locations used directly by a processor’s arithmetic instructions, have to be supplied with inputs and weights. Intermediate results also have to be written somewhere. How much work the processor can do with the values it has already loaded affects runtime and energy.

The paper uses arithmetic intensity to describe this reuse. In its account, arithmetic intensity is the average amount of arithmetic performed per byte loaded into a processor register. For the same arithmetic workload, greater reuse reduces the amount of loading required. A computation with little reuse can spend a large share of execution moving data, even when its operation count looks modest. Energy per inference incorporates the consequences of how the device executes the computation, while latency describes how long that inference takes. Both are part of the paper’s case for measuring networks under conditions resembling deployment.

Why lightweight building blocks became common

The authors place XiNet alongside earlier efforts to make convolutional networks practical on mobile and embedded hardware. Their examples include Xception, MobileNetV2, EfficientNet, and ShuffleNet. These designs seek a useful compromise between recognition quality and computation, with parameter counts and MAC counts serving as guides. This way of looking at the problem makes depthwise convolution appealing. A standard convolution mixes channels while looking at spatial neighborhoods. A depthwise convolution applies its spatial filter separately to each channel, which reduces the weights and arithmetic needed for that operation. The paper discusses this design tradition alongside MobileNets.

A depthwise layer is frequently surrounded by other operations that let the block mix channels. MobileNetV2 is relevant because it uses an inverted residual block. This block first enlarges the channel dimension using a pointwise convolution, which mixes features at each spatial position without looking at adjacent positions. The depthwise convolution then acts on the expanded representation. A further pointwise operation projects the result back to the block’s output width. For the full block, the expanded activation and the weights of the surrounding projections matter alongside the cheap spatial filter. The useful comparison for deployment is the cost of obtaining the block’s output while preserving any input required by a skip.

The paper also describes specialized work on microcontroller deployment, including MCUNet and its patch-based successor. The authors recognize that this line of work takes constraints such as memory seriously. Their concern is that custom acceleration, compiler support, and architecture search can make adaptation more involved when the target hardware or task changes. Architecture search is a procedure for choosing a network structure from a set of candidates. If a device has a different combination of FLASH, RAM, and available computation, the original choices may no longer give the preferred resource balance.

An earlier idea in PhiNets gives XiNet a different starting point. Hardware Aware Scaling is a way of changing an established architecture to address resource constraints through separate adjustments. This matters because devices can impose different kinds of scarcity. More room for weights does little for an inference that runs out of temporary storage. A network that fits both forms of memory can still take too long to process a frame. Where ordinary width scaling changes many layers together, a design with several controls can change where work happens and how large its intermediate tensors become.

Why attention and connections also matter

Attention presents another version of the deployment problem. In a vision network, an attention module can assign greater or lesser importance to information in a feature tensor. The paper distinguishes channel attention, spatial attention, and self-attention. Channel attention produces a set of importance values for the channels. Spatial attention emphasizes locations. Self-attention relates positions to other positions, so the tensor holding those relationships can grow rapidly with the size of a feature map. The authors discuss both direct and patch-based approaches to these interactions in their treatment of Transformer and attention.

For embedded inference, the operations needed to produce and apply those weights can matter as much as their arithmetic count. The paper points to channel attention mechanisms that need global average pooling and a matrix–vector operation. Global average pooling summarizes each channel across spatial positions. The authors describe toolchains with limited support for the matrix–vector step and hardware engines that can leave pooling to the CPU. Even when such a module adds little arithmetic to the network, these implementation details can make it more expensive to execute. Spatial attention is attractive because applying its weights can use element-wise multiplication, an operation that multiplies corresponding entries of arrays. Generating the weights efficiently remains a separate design task.

Skip connections raise a question about storage and shape. A connection between blocks can carry forward features computed earlier in the network. As a network gets deeper, its tensors can have fewer spatial positions and more channels. An earlier tensor and a later output may then have different dimensions, which prevents a direct element-wise sum. The paper discusses prior work on linking layers with such differences and on giving a layer access to several earlier outputs. XiNet brings the cost of aligning and retaining those tensors into the design of the skip path itself.

The method, step by step

Measure the operations before choosing the block

The authors begin with individual operators. They compare several ways to perform convolution, then look at downsampling and upsampling. Downsampling reduces the number of spatial positions in a feature tensor. Upsampling increases it, as can be needed when an object detector combines signals at different spatial resolutions. The hardware spans STM32 microcontrollers, a Raspberry Pi, a processor with a tensor processing unit, and a multicore RISC-V microcontroller. The measurements include power, latency, clock cycles, and energy. Energy is the quantity used to define the comparison with standard convolution.

From operator measurements to a scaled XiNet

The steps in order.

From operator measurements to a scaled XiNetStep 1: Measure operators against standard convolution1. Measure operators against standard convolutionStep 2: Compress channels with a pointwise convolution2. Compress channels with a pointwise convolutionStep 3: Transform the compressed features with standard convolution3. Transform the compressed features with standard convolutionStep 4: Downsample where needed and activate the features4. Downsample where needed and activate the featuresStep 5: Produce and apply pointwise attention weights5. Produce and apply pointwise attention weightsStep 6: Pool and project earlier features before adding them6. Pool and project earlier features before adding themStep 7: Scale width, channel distribution, and compression for deployment7. Scale width, channel distribution, and compression for deployment

The energy comparison uses workloads with equivalent MAC counts. The numerator is the energy needed by a standard convolution and the denominator is the energy spent by the operator being tested. The authors choose standard convolution as the reference because it is a widely optimized operation on the devices of interest.

ηₒₚ = Eₛ / Eₒₚ

Here ηₒₚ is the relative energy efficiency of the tested operator. The subscript ₒₚ indicates that operator, and ₛ denotes the standard convolution used as a reference. Eₛ and Eₒₚ are their respective energy requirements at the matched MAC workload. A higher ηₒₚ means the tested operator requires less energy for that workload. This is a comparison of energy consumed over a computation. Runtime and power are separate measurements that help explain the energy result.

The authors test standard, pointwise, depthwise, and grouped convolutions. In grouped convolution, the channels are divided so the spatial computation mixes features within each group. The upsampling comparison includes transposed convolution, nearest-neighbor and bilinear interpolation, and depth-to-space, which rearranges values from channels into spatial positions. For downsampling, the alternatives are strided convolution and max or average pooling. A strided operation advances through input positions by larger steps. Pooling condenses a local region to a value, such as its maximum or average. The benchmark leaves out batch normalization because its inference-time transformation can be folded into the preceding convolution.

Work out what the tensors cost

The paper explains depthwise convolution’s deployment cost using a processor example. On a SIMD-equipped ARM core operating on uint8 values, the authors describe a depthwise implementation that uses three SIMD loads and one SIMD store per multiply–add. SIMD means that a single instruction acts on several data values together. In this example, the values loaded are the input, kernel, and output being accumulated, with the output written back. The depthwise filter changes with the channel, so the same kernel values cannot simply be kept for the next channel. The authors contrast this limited reuse with what they observe in standard and pointwise convolutions.

They give a separate worked example to show which tensors fit. Imagine a block retaining an input tensor for a skip while also holding the expanded output of its pointwise convolution. The input has width W, height H, and C channels. The expansion gives the new tensor t times as many channels. Their storage calculation treats one value as occupying a byte. The maximum channel count is the whole number of channels that can fit when the original and expanded tensors must be present together.

Cₘₐₓᴰᵂ = ⌊R / (W × H × (t + 1))⌋ = 3

Cₘₐₓᴰᵂ is the maximum unexpanded channel count in the inverted residual example. DW identifies the block that uses depthwise convolution. R is the available working memory, W and H are the spatial dimensions, and t is the expansion factor. The 1 in the sum accounts for the original input tensor. The floor brackets ⌊ ⌋ round down to a whole number of channels. The reported result of 3 uses t = 6, R = 320KB, and W and H each equal to 128, with an STM32F7 as the example device.

The corresponding standard convolution example uses the same spatial dimensions and memory budget. It allows room for an input and an output tensor of equal width. The channel expansion that dominated the previous expression is absent from this calculation.

Cₘₐₓˢ = ⌊R / (W × H × 2)⌋ = 10

Cₘₐₓˢ is the maximum channel count for the standard convolution case, identified by S. R still denotes the available RAM and W and H still denote tensor width and height. The factor 2 accounts for the input and output of equal size. The floor brackets again keep only the whole channels that fit. The value 10 is the paper’s result for this worked example. The two results show how the expansion factor changes the channel width a fixed memory allowance can support at the same spatial resolution.

Weights pose a different question. The paper gives the kernel weight counts for a standard convolution and a depthwise convolution with equal input and output channel counts. In the standard case, a spatial filter contributes weights for every input and output channel pairing.

K²C²

K is the side length of the square convolution kernel, the grid of learned weights used to combine nearby values. K² counts positions in that grid. C is both the input and output channel count in this example. C² accounts for pairing every input channel with every output channel.

K²C

K and C have the same meanings in the depthwise weight count. Each of the C channels has its own spatial filter. The single factor C reflects the absence of cross-channel pairings within this operator.

The paper next compares parameter counts for a full inverted residual block and a standard convolution. In the example, K = 3 sets the kernel size, t = 6 sets the expansion factor, and C = 32 sets the channel count. The authors print the following comparison.

Pᴰᵂ⁺²ᴾᵂ / Pˢ = (2tC + K²) / (K²C) ≈ 1.4

Pᴰᵂ⁺²ᴾᵂ denotes the parameter count attributed to the depthwise convolution with its pair of pointwise convolutions, identified by PW. Pˢ is the standard convolution’s parameter count. C denotes the channel width before expansion and after projection, t is the expansion factor, and K is the spatial kernel side length. The factor 2 counts the expansion and projection stages. The symbol ≈ marks the paper’s approximate ratio of 1.4 for the stated example. The written expression uses an unexpanded depthwise term even though the block description applies the filter to expanded channels. Its role in the argument is to show that the pointwise projections can erase the apparent parameter advantage suggested by the isolated depthwise kernel count.

Put the compression before spatial filtering

XiNet’s main convolution uses a square kernel with K = 3. To restrain the amount of computation, the authors change the number of channels that enter the convolution. An initial pointwise layer accepts the block input and produces a compressed representation. The standard convolution reads that narrow representation and produces the wider output. Channel compression therefore limits the work of cross-channel spatial filtering while preserving that filtering as the block’s main operation.

The compression factor γ expresses the ratio between the main convolution’s output width and its compressed input width. For a fixed output width, increasing γ narrows the tensor the spatial kernel reads. The paper describes a corresponding factor γ reduction in the parameters and MACs of the scaled main convolution relative to an equal-width input. The initial pointwise projection still has its own cost. The complete block also contains other operations, so the factor describes the effect on the main convolution instead of an exact saving for every part of the architecture.

The authors give a working-memory comparison that holds the spatial dimensions and output channel count fixed. In the inverted residual case, they consider the input and output of the depthwise operation itself. Both tensors have the expanded channel width during this operation.

RAMᴰᵂ = 2tWHCₒᵤₜ

RAMᴰᵂ denotes the working storage counted for the depthwise operation within the expanded block. W and H are the width and height of the tensors, and Cₒᵤₜ is the reference output channel count of the block. The expansion factor t gives the width of each of the depthwise operation’s input and output tensors relative to that reference. The multiplier 2 counts both tensors. This formula studies a different point in execution from the earlier example that pairs the expansion output with a retained, unexpanded skip tensor.

For the main standard convolution in XiNet, the input is already compressed. The output still has the intended full channel width. The analysis counts the storage for those tensors during that convolution.

RAMˢ = WHCₒᵤₜ + WHCₒᵤₜ / γ

RAMˢ denotes the working storage counted for the proposed standard convolution. W, H, and Cₒᵤₜ again give the reference width, height, and output channel count. The first term is the output tensor. The second is the compressed input tensor. The compression factor γ sets its channel count relative to Cₒᵤₜ.

RAMᴰᵂ / RAMˢ = 2tγ / (γ + 1)

The ratio divides the working storage of the expanded depthwise operation by that of the proposed standard convolution. RAMᴰᵂ and RAMˢ are the quantities in the preceding expressions. The factor t controls expansion and γ controls compression. The 2 counts the expanded input and output, and the 1 in the denominator reflects the uncompressed output on the XiNet side after the terms are put over a common denominator. The authors describe the saving as nearly 10× when t = 6 and γ = 4. This is a comparison of the tensors associated with the central operation. The paper’s separate measurements and configuration results address memory for complete networks.

The rest of the convolutional block is designed with quantization in mind. Quantization represents values at reduced numerical precision for inference. The authors use max pooling for downsampling because they expect the resulting activation range to improve the signal relative to quantization noise. They choose ReLU6, a bounded activation function, over Swish or SiLU. ReLU6 is used after the main convolution. The pointwise layer that produces the compressed tensor is kept linear because the authors found that inserting an activation at that stage can discard features useful to subsequent computation.

Change width and shape for the device

XiNet’s hardware scaling uses α, β, and γ. The width multiplier α changes the number of filters throughout the network. The shape factor β changes the distribution of channels from early to late blocks, and the compression factor γ changes the width of the representation entering the main convolution. The authors also follow the practice of expanding the channel count after downsampling, as in Deep Residual Learning for Image Recognition.

Cₒᵤₜⁱ = 4 ⌈α × 2^(Dᵢ − 2) × (1 + (β − 1)i / N) × Cₒᵤₜ⁰⌉

Cₒᵤₜⁱ is the output channel count for block i, where the superscript marks its position and is not a power. Cₒᵤₜ⁰ is the base channel count given for the first convolutional block. N gives the overall count of convolutional blocks, while Dᵢ gives the count of earlier downsampling blocks. The factor 2 raised to Dᵢ − 2 sets the scale associated with the downsampling schedule, with the subtraction of 2 serving as the offset in the paper’s formula. The term beginning with 1 changes the width linearly with position according to β. The multiplier α sets the overall width. The brackets ⌈ ⌉ indicate a ceiling, and the outer 4 makes the result a multiple of 4.

The text describes the alignment as rounding to the closest multiple of 4, while the printed formula uses a ceiling. Both express the intent to align channel counts with hardware that can process 4 uint8 values in a 32-bit register using SIMD. The formula makes that granularity visible. A small change in a real-valued width setting can leave a block with the same actual number of channels. The scaling settings describe the intended resource tradeoff, and the implemented block widths reflect the alignment rule.

Width scaling changes both sides of many convolutions. As the input and output channel counts grow together, the kernel has more combinations of features to mix at each spatial position. A feature tensor’s own size, by comparison, depends on its spatial dimensions and its channel count. Which tensors set peak RAM can depend on where in the network they occur and which ones must be kept at the same time. The paper describes α as affecting operations, parameters, and RAM together. The tensor formulas give the more specific dependence for the individual operations they describe.

The shape factor matters because changing channels near the input has different implications from changing them later. Early blocks handle larger spatial tensors. Later blocks, after downsampling, generally apply their filters at fewer locations. The paper describes β < 1 as favoring lower parameter counts at the expense of more computation, and β > 1 as favoring simpler computation at the expense of more parameters. Moving capacity towards later layers can preserve weights for feature transformations that are applied at fewer spatial positions. The distinction between how many weights exist and how frequently those weights are used is what makes changing the shape useful.

The compression factor γ acts at another point in the calculation. It changes the representation read by each main convolution while leaving the planned output width available for the rest of the network. These settings together let the designer adjust overall capacity, the location of the work, and the width of the block’s most important intermediate representation. The input resolution also varies across the detection configurations. The settings can therefore be selected with the dimensions of the feature maps, as well as their channels, in view.

Form an attention mask with compatible operations

The authors want the attention module to vary across both location and channel. They generate a mask with the same shape as the block output, so each feature value has a corresponding attention value. Wₒᵤₜ and Hₒᵤₜ describe the spatial size of both tensors, and Cₒᵤₜ gives their channel count. With matching dimensions, the module applies the mask by element-wise multiplication. A mask value can then influence a particular feature at a particular location without explicitly building a matrix of relationships between spatial positions.

Several alternatives produce such a mask. The authors test a version based on a standard convolution and a lighter variant that strides along the channel axis. They also try pointwise attention with and without a nonlinearity. Another variant splits the main block convolution into separate operations and uses part of the computation to produce the attention map. A final variant works on the compressed representation. These constructions vary in the work needed to generate the mask, with the element-wise application serving as their common design principle.

XiNet uses the pointwise variant without the added nonlinearity in the mask generator. Pointwise convolution can combine channels at each spatial location using a familiar embedded operation. The authors also choose it for practical reasons relative to the split variant. The pointwise design creates fewer separate pieces of computation, and it avoids a concatenation step that would assemble those pieces into a single tensor. The measurements behind the selection come from a small CIFAR-100 classifier and are discussed separately from the full classification benchmark.

Align skip tensors and learn which ones to keep

A skip connection provides a route for earlier features to reach a later block. XiNet first applies average pooling to the incoming tensor on this route so its spatial dimensions match those of the destination. A pointwise convolution then changes its channel count. Once the shapes agree, the network adds corresponding entries of the skip tensor and the main output. Concatenation, the alternative discussed by the authors, would instead join tensors along a dimension for a later operator to process.

The order of the two alignment operations is important. Suppose an early tensor has a large spatial grid but relatively few channels, while the destination has a smaller grid and more channels. Pooling first produces a smaller grid while the feature count is still low. The pointwise projection increases the channel count only after that reduction. The authors also explain that pooled features can be retained for later layers in place of the original high-resolution array where the later uses permit it. The design consequently addresses both the intermediate tensor made while aligning a skip and the tensor kept alive between blocks.

To decide which earlier features to use, the authors train a network in which each block can receive information from all preceding blocks through these alignment paths. Each skip tensor has a trainable weight. A softmax converts the weights to normalized scores that express how much influence the connections can have in the weighted combination. Training assigns scores to candidate paths in a shared network. The authors describe this as an approximation to a larger collection of possible subnetworks.

N!

N is the number of blocks in the network. The exclamation mark denotes a factorial, and N! is the number used in the paper’s description of the approximated collection of subnetworks. The procedure trains the shared network and then examines the learned scores at convergence. The factorial expression characterizes the search as the authors frame it, while the learned weights provide the evidence they inspect when selecting a data path.

CIFAR-100 supplies the image classification task for this search. It is also the dataset used to train and compare the different attention variants, in a XiNet with five convolutional blocks. The full classification and detection experiments use the architecture chosen from these design investigations. For detection, a version of YOLOv7 supplies the starting structure. XiNet replaces the feature-extracting backbone, and the detection head also adopts XiNet blocks. The head is the portion of a detector that converts features into its predictions. The paper directs readers to its supplementary materials for the training procedure and baseline implementation details.

Experiments and results

How the operators behave on hardware

Standard convolution has the highest average efficiency in the operator benchmark, and pointwise convolution behaves similarly. According to the authors, depthwise, group-based, and patch-based convolutions each use about triple the energy of an equivalent standard convolution. The condition on arithmetic matters. This comparison fixes the amount of MAC work. A complete network’s energy still depends on the quantity of work carried out by each operator and on the tensors that have to be moved or retained.

There is a hardware-specific exception in the grouped-convolution results. The GAP8 shows high efficiency for that operator. The authors attribute this to a processor design suited to parallel execution and treat the observation as an outlier for the purpose of choosing a broadly applicable block. A design concentrating on that platform could weigh this operator differently. XiNet’s design decision comes from looking for a useful operator across devices with different execution characteristics.

The tested downsampling alternatives are close in efficiency. This gives the architecture room to choose max pooling for its expected effect on quantized activations or average pooling for how it aligns a skip tensor. The tested upsampling operations have much lower efficiency than the standard-convolution reference. Bilinear upsampling has a modest advantage within that group, especially on microcontrollers. The paper uses these results to characterize available operations, instead of supplying a numerical account of how much each one contributes to the energy of the final detector.

CIFAR-100 classification

Image classification assigns a category to an input image. The classification experiment measures accuracy, throughput in frames per second, and energy per inference. The authors run XiNet-Class on an STM32H7 microcontroller at 280MHz and on a Raspberry Pi 4. The comparison table identifies the microcontroller as STM32H7A3. Its baselines are MCUNet in3, MCUNet in4, and PhiNet. The accuracy table reports one CIFAR-100 score for each architecture without giving a separate score for each device.

The XiNet-Class configuration has an input resolution setting of 160. Its width multiplier α is 1, its shape factor β is 1.5, and its compression factor γ is 4.0. The authors report that it requires 204KB of RAM and 259M MACs. These are properties of the configuration tested for classification. The later detection experiments change the settings and, with them, both the spatial resolution and the resource requirements.

XiNet-Class reaches 72.27% accuracy on CIFAR-100. MCUNet in4 scores 72.86%, MCUNet in3 scores 69.62%, and PhiNet scores 69.17%. The closest accuracy comparison for XiNet-Class among these baselines is therefore with MCUNet in4. That baseline also has the slowest throughput and the highest energy cost of the compared systems on both devices. Which classifier is preferred depends on the importance of the accuracy ranking and of the measured execution costs.

CIFAR-100 classifier energy per inference on STM32H7A3

XiNet-Class uses the least energy per inference among the compared classifiers.

CIFAR-100 classifier energy per inference on STM32H7A3MCUNet in4: 71.9MCUNet in471.9MCUNet in3: 53.0MCUNet in353.0PhiNet: 31.6PhiNet31.6XiNet-Class (this paper): 22.3XiNet-Class (this paper)22.3
The numbers
System or settingmJ per inference
MCUNet in471.9
MCUNet in353.0
PhiNet31.6
XiNet-Class (this paper)22.3

On the STM32H7A3, XiNet-Class processes 3.40 frames per second. PhiNet processes 2.40, MCUNet in3 processes 1.34, and MCUNet in4 processes 1.11. PhiNet is the fastest baseline on this device, while MCUNet in4 is the baseline nearest XiNet-Class in accuracy. The paper highlights a speedup of more than 3× at similar accuracy for the comparison with a depthwise-based classifier. The measurements give a different throughput relationship for each baseline.

The Raspberry Pi 4 comparison preserves the same throughput ordering. XiNet-Class processes 30.6 frames per second, PhiNet processes 15.6, MCUNet in3 processes 10.8, and MCUNet in4 processes 7.70. The reported energy per inference on the Raspberry Pi 4 is 165mJ for XiNet-Class, 324mJ for PhiNet, 469mJ for MCUNet in3, and 657mJ for MCUNet in4. Thus the architecture with the lowest measured energy is also the fastest on each platform, even though the absolute throughputs and energy costs differ between platforms. This is the most direct complete-network evidence for the paper’s efficiency argument.

Detection with small YOLO architectures

Detection asks the network to identify objects and locate them in the image, so the prediction includes spatial information. The paper evaluates detection quality with mean average precision, or mAP. Average precision summarizes how well a detector retrieves correct detections as its confidence threshold changes. Mean average precision aggregates that measure across categories. The precise evaluation protocol matters when comparing scores across experiments, so the reported tradeoffs belong to their respective benchmark comparisons.

For the COCO experiment, the authors begin with YOLOv7, replace its backbone with XiNet, and use XiNet convolutional blocks in the head. This comparison is meant to explore the tradeoff among small detectors without fixing a single hardware target. The shape factor β is held at 1.4, the compression factor γ is held at 4.0, and the authors vary the width multiplier α to obtain a range of operation counts. They evaluate the resulting detectors on Microsoft COCO.

The paper compares these settings with small detectors from different generations of YOLO. Its figure places detection quality against computational complexity and represents RAM through the size of the plotted points. That view lets the reader consider temporary storage alongside arithmetic when comparing points with similar precision. The authors report a better performance and complexity tradeoff for XiNet across the alternatives in the figure. A comparison at similar mAP can ask how much computation and RAM are needed, while a comparison at a similar resource budget can ask how much detection quality the network delivers. The paper presents the COCO comparison through the plotted tradeoffs.

Detection with a fixed microcontroller budget

The VOC-2012 experiment sets an explicit deployment target. The selected STM32H743 provides 2MB of FLASH and 512KB of RAM for the network. The authors compare XiNet with official MCUNet results and include comparisons with PhiNet in the resource plots. They produce several XiNet configurations for different priorities. The largest aims to use the resources available on the device, the smallest emphasizes working memory and energy, and the middle configuration aims to make use of FLASH while balancing the other costs.

XiNet-S has an input resolution setting of 256, α of 0.4, β of 2.0, and γ of 4.0. The authors give it a RAM requirement of 53KB and a computation count of 80M MACs. XiNet-M uses a resolution setting of 384, with α of 0.4, β of 2.0, and γ of 4.0. Its stated requirements are 138KB of RAM and 220M MACs. These configurations keep all three channel settings the same. Their reported resource requirements show the role of the spatial resolution setting in this family of detectors.

XiNet-L uses a resolution setting of 416, α of 0.45, β of 1.8, and γ of 4.0. The table reports 511KB of RAM and 789M MACs. It is the configuration the authors describe as using the most capacity that fits their target, with the RAM figure close to the stated 512KB budget. Because the width, shape, and resolution settings all differ from XiNet-M, the comparison with that configuration shows the joint effect of the choices. The settings form a deployable family with different operating points.

The VOC-2012 plots compare mAP against RAM and against operation count. The authors cite MCUNetV2 H7 as an example comparison and report that, when scaled to comparable detection performance, XiNet uses one-ninth the RAM and half as many operations. This claim concerns a matched level of detection quality. The larger XiNet configurations address a different question, namely how much detection quality can be obtained when more of the microcontroller’s available resources are used.

The authors also give examples of running the detectors with camera-sized images. XiNet-S achieves 8 frames per second for 320 × 240 images on the STM32H743. XiNet-M runs at 3 frames per second for 640 × 480 images on the Raspberry Pi 4. These numbers characterize different XiNet settings, devices, and image dimensions. The tabulated resolution settings describe the benchmark configurations, while the throughput sentences identify the dimensions of the images in those examples.

The abstract reports a detection energy reduction of 70% at similar performance. The detector results discussed in detail emphasize mAP, RAM, arithmetic, and the throughput examples. These measures describe different aspects of running the system. A reported reduction in MACs characterizes the arithmetic budget, and a reduction in RAM characterizes the deployment footprint. The operator benchmark and the CIFAR-100 measurements show why an energy result is best treated as a separate quantity, dependent on how the device executes the architecture.

What the ablations show

Different attention masks have different costs

The attention experiment compares a five-block XiNet with no attention against versions using the candidate mask generators. The task is classification on CIFAR-100. The paper reports changes in top-ranked classification accuracy, together with energy per inference and MAC throughput measured on an STM32H743. Top-ranked accuracy concerns the category the classifier places first. The reported gains are relative to the no-attention setup and appear in the paper as signed percentages. MAC throughput is the rate at which the arithmetic is performed. A higher rate can coexist with greater energy per inference if the variant has much more work to do.

The standard-convolution attention variant gives the largest reported accuracy gain, +11.4%, and the highest MAC throughput, 143.9M per second. It also has the highest energy cost, at 10.2 mJ. The no-attention setting takes 1.68 mJ and reaches 137.7M MACs per second. This comparison makes the motivation for a lighter attention mechanism explicit. The standard-convolution variant can run its arithmetic at a favorable rate on the microcontroller while still asking the device to carry out substantially more computation per image.

CIFAR-100 top-ranked accuracy gain by XiNet attention variant

The selected pointwise variant gives a gain close to the split variant, while adding ReLU weakens its result.

CIFAR-100 top-ranked accuracy gain by XiNet attention variantNo attention: +0No attention+0Standard convolution: +11.4Standard convolution+11.4Channel stride: +6.1Channel stride+6.1Pointwise (this paper): +10.1Pointwise (this paper)+10.1Pointwise with ReLU: -0.5Pointwise with ReLU-0.5Split convolution: +10.5Split convolution+10.5Attention on compressed features: +8.3Attention on compressed features+8.3
The numbers
System or settingreported accuracy gain %
No attention+0
Standard convolution+11.4
Channel stride+6.1
Pointwise (this paper)+10.1
Pointwise with ReLU-0.5
Split convolution+10.5
Attention on compressed features+8.3

Comparing the two pointwise variants tests the effect of the added nonlinearity inside the attention design. Both use 3.46 mJ per inference. Their arithmetic throughputs are also close, at 122.4M MACs per second for the plain pointwise variant and 122.1M for the variant with ReLU. Accuracy moves in different directions. Plain pointwise attention reports a gain of +10.1%, while its counterpart reports -0.5%. The result bears specifically on that activation choice in the candidate mask generator. The main block still uses ReLU6 after its spatial convolution.

The split approach has a gain of +10.5% and costs 3.93 mJ per inference. Its MAC throughput is 104.4M per second. Attention operating on compressed features yields +8.3% and costs 3.41 mJ, with a rate of 120.5M MACs per second. The channel-stride alternative records +6.1% at 3.54 mJ and 115.7M MACs per second. Looking at these variants together shows that the accuracy benefit depends on where and how the mask is generated. For XiNet, the authors choose plain pointwise attention because it delivers a gain near the split variant’s, with lower measured energy and a simpler execution path.

The full block gains accuracy from its additions

The paper also tests the block design with and without the proposed attention and skip mechanisms. The base architecture is a sequence of convolutional blocks without either addition. Its reported mAP is 72.3 and its reported efficiency is 68%. The complete XiNet, with both additions, gives 74.9 mAP and 67% efficiency. This is the comparison that directly tests whether the chosen features can coexist in the architecture while preserving a similar level of efficiency.

The intermediate configurations record 72.7 mAP at 64% efficiency and 74.4 mAP at 70% efficiency. Both stand above the base in mAP, with different effects on the efficiency measure. The complete architecture has the highest reported mAP among the configurations. Its efficiency sits between the intermediate values. The paper interprets this as an improvement in detection quality with a limited change in efficiency for the complete block. The mAP values in this architectural comparison answer a different question from the relative classification accuracy gains in the attention-mask experiment.

The ablation expresses efficiency as a percentage. It therefore gives a way to compare the four entries as the paper reports them. The classification table’s millijoule measurements describe the energy of running full networks on named devices. Keeping these units distinct avoids turning a small movement in the ablation’s percentage into an unsupported numerical claim about energy per image.

The learned skip weights favor early features

The skip analysis asks which earlier blocks supply useful information to later ones when the candidates are trained together. The authors inspect the weight magnitude assigned to each connection after training the candidate network on CIFAR-100. Their figure presents average importance by source layer alongside scores for individual destinations. The weight assigned to features from the first convolutional block is particularly strong across the network.

The authors offer feature reuse as an explanation. Adjacent blocks can already carry much of the same information, so an extra connection from a nearby layer may contribute less than one from farther back. An earlier feature tensor can supply information that has changed as it traveled through the main path. The weights reveal a preference under the trained combination. Their interpretation in terms of feature diversity is an explanation of that preference.

The result also supports a memory decision because the first block has the fewest channels. Pooling at that width keeps the retained skip tensor relatively small before a later pointwise layer brings it to the destination’s channel count. The paper reports a 5× reduction in the size of the skip tensor for deeper blocks. That figure describes the skip tensor specifically. The complete network’s peak RAM also depends on the main path and on any other tensors needed at the same time.

Scaling demonstrates different operating points

The detection configurations show a form of analysis distinct from removing a block component. On COCO, the authors hold the shape and compression factors fixed while varying the width multiplier. The comparison traces what happens to detection quality and complexity as the detector is widened under those conditions. On VOC-2012, the small and medium versions share the same channel settings and use different resolution settings. They illustrate how changing spatial dimensions alone within that pair changes the resource demands.

The largest VOC-2012 configuration combines a larger resolution setting with changes in width and shape. It shows the high-resource end of the family for the selected microcontroller. Its comparison with the medium version addresses what can be achieved by choosing several settings together. The paper’s practical case for scaling rests on these different operating points. The choices let an architect build a smaller detector for a tighter budget or devote more memory and computation to detection quality when the device can accommodate it.

Limitations

Limits the authors identify

The authors recognize that working memory depends on the inference engine. Their argument for operator-level memory comparisons holds the engine fixed so tensor sizes can be compared on the same basis. The derived examples explain why expanded and compressed tensors differ in cost. A deployment’s measured memory also reflects when its engine allocates, reuses, and frees storage. The paper reports a RAM footprint for specific XiNet configurations in addition to the memory analysis of their building blocks.

The operator study exposes differences between processors. The authors explicitly single out the GAP8 grouped-convolution result and explain why it has less influence on their general design choice. Their architecture is intended to suit a range of devices. That goal leads them toward operators that perform well broadly, even where a particular chip has an unusually favorable implementation of another operation. Operator implementations and toolchain coverage also motivate their treatment of attention.

The paper identifies concrete difficulties for larger attention mechanisms on microcontrollers. Computing relationships across all positions produces a large intermediate array. For a 128 × 128 input tensor, the authors give an example that requires 270MB of RAM, against the < 1MB memory setting they discuss for small embedded devices. They also question whether partitioning already small inputs gives useful patches under such constraints. These are reasons for the local, element-wise design chosen for XiNet. The argument is framed around the feature resolutions and low-memory setting of interest to the authors.

The paper refers readers to supplementary materials for details of operator workloads, attention implementations, classifier and detector training, and baseline implementations. In the main presentation, the authors specify the architectural operations and key resource settings, along with the tasks on which attention and skips are selected. The training schedules and associated implementation choices are treated separately. That distinction matters when assessing which aspects of the experimental setup are specified by the architectural description alone.

Limits of the comparisons

The matched-MAC benchmarks establish relative energy use for tested workloads. A block built around an operator that uses more energy per matched MAC can still use fewer MACs in total. Conversely, an efficient operator can use considerable energy if an architecture applies it very widely. The full classifiers give a check on what happens after the choices are combined. They show the observed outcome for those networks and devices, while the operator experiments explain why XiNet’s choice of standard convolution is plausible.

The effect of the memory formulas also has a clear scope. They compare particular sets of live tensors under stated assumptions about their dimensions. The formula involving nearly 10× concerns the main operator in a comparison with an expanded depthwise operation. The 9× claim concerns scaled detectors at similar VOC-2012 performance. These figures describe different comparisons. Applying either to a new configuration would require knowing its activation sizes, execution schedule, and the network being used for comparison.

The formulas leave some implementation choices unresolved. The printed parameter ratio uses a depthwise contribution based on the unexpanded channel count, while the block description puts that computation in the expanded representation. For channel alignment, the prose describes the closest multiple of 4 and the equation specifies an upward rounding operation. The same precision issue matters when interpreting scaling claims. At fixed spatial resolution, the storage of one feature tensor scales with its channel count, while convolutional weight counts can depend on the product of input and output widths. The observed peak RAM for an entire network is the appropriate quantity for testing the combined effect of the scaling choices.

The classification results are direct hardware measurements, with one reported accuracy per configuration and an energy and throughput measurement on each device. That design supports comparison among the listed networks. The table gives point estimates, so it does not establish how sensitive the accuracy ordering is to training variation. Nor does the Raspberry Pi result establish a throughput target for detection. Classification and detection produce different outputs, and the detector throughput examples change the device, network configuration, and image dimensions together.

The detector comparisons make the resource tradeoff visible without giving the same detail as the classifier measurements. The COCO figure presents the relationship across detector settings, and the VOC-2012 analysis combines plotted results with official baseline results. The headline 70% detection energy reduction is more specific than the hardware and baseline detail accompanying it in the main discussion. The worked detector examples identify feasible execution rates, while the classifier table allows a direct per-inference energy comparison for each listed system on each named platform. The two kinds of evidence support different levels of precision about energy.

Limits of the design analyses

The attention and skip investigations are concentrated on CIFAR-100. The attention experiment is especially informative for the chosen small network and the STM32H743. Its comparison holds the base task and network family in view while varying how the mask is produced. The same ranking across detection datasets, other block widths, and other inference engines would require corresponding measurements. The complete detector ablation shows that the chosen mechanisms can improve mAP together, while the mask experiment gives finer detail about the alternatives within the classifier setup.

The learned skip scores indicate which connections the trained network preferred when they were available together. A normalized score depends on the competing paths and on features formed elsewhere during training. It is therefore evidence about the trained routing arrangement. The suggested role of feature diversity is plausible within that arrangement, and the lower channel count of the first block grounds the memory argument. Establishing the same routing preference in another task would require repeating the selection or directly evaluating alternative paths there.

Finally, the VOC-2012 configurations demonstrate useful resource choices without isolating every scaling factor. Compression stays at 4.0 across those detectors. The comparison between the small and medium versions changes the resolution setting while holding their channel settings fixed. The largest configuration changes several settings at once. The family demonstrates the practical flexibility the authors sought, while separate sweeps would be needed to quantify the contribution of each setting under a fixed task and deployment budget.

What came after

There are no documented follow-up studies to discuss. The related work described in the paper establishes the design’s lineage, especially the use of Hardware Aware Scaling in PhiNets and the adaptation of YOLOv7 for detection. The evidence here concerns what XiNet demonstrated in its own experiments. How later systems reused its measured operator choices, attention design, or scaling controls remains undocumented.

Cite

Cite as Alberto Ancilotto, Francesco Paissan and Elisabetta Farella. 2023. XiNet: Efficient Neural Networks for tinyML. IEEE/CVF International Conference on Computer Vision (ICCV).

The paper itself, not this page. BibTeX from the library's record of the work. DOI 10.1109/iccv51070.2023.01556

@inproceedings{ancilotto2023xinet,
  title = {{XiNet: Efficient Neural Networks for tinyML}},
  author = {Alberto Ancilotto, Francesco Paissan and Elisabetta Farella},
  booktitle = {IEEE/CVF International Conference on Computer Vision (ICCV)},
  year = {2023},
  doi = {10.1109/iccv51070.2023.01556},
  url = {https://doi.org/10.1109/iccv51070.2023.01556}
}

↑ back to top

This page in Markdown https://md.research.elamur.ai/free/en/papers/ancilotto-2023-xinet-efficient-neural-networks-tinyml/