Searching Constrained Subnetworks - 3.5 English

Vitis AI User Guide (UG1414)

Document ID
Release Date
3.5 English
After training is completed, you can conduct an evolutionary search based on the neural-network-twins to get a subnetwork with the best trade-offs between MACs and accuracy using a minimum and maximum MACs range.
pareto_global = ofa_pruner.run_evolutionary_search(ofa_model, calibration_fn, (train_loader,) eval_fn, (val_loader,), 'acc1', 'max', min_macs=230, max_macs=250)

ofa_pruner.save_subnet_config(pareto_global, 'pareto_global.txt')

The evolutionary search result looks like the following:

"230": { 
    "net_id": "net_evo_0_crossover_0", 
    "mode": "evaluate",
    "acc1": 69.04999542236328,
    "macs": 228.356192,
    "params": 3.096728,
    "subnet_setting": [...]
"240": {
    "net_id": "net_evo_0_mutate_1",
    "mode": "evaluate",
    "acc1": 69.22000122070312,
    "macs": 243.804128,
    "params": 3.114,
    "subnet_setting": [...]