Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

Keras HaloNet


Summary

Models

Model Params FLOPs Input Top1 Acc Download
HaloNextECA26T 10.7M 2.43G 256 79.50 halonext_eca26t_256_imagenet.h5
HaloNet26T 12.5M 3.18G 256 79.13 halonet26t_256_imagenet.h5
HaloNetSE33T 13.7M 3.55G 256 80.99 halonet_se33t_256_imagenet.h5
HaloRegNetZB 11.68M 1.97G 224 81.042 haloregnetz_b_224_imagenet.h5
HaloNet50T 22.7M 5.29G 256 81.70 halonet50t_256_imagenet.h5
HaloBotNet50T 22.6M 5.02G 256 82.0 halobotnet50t_256_imagenet.h5

Comparing HaloNetH7 accuracy by replacing Conv layers with Attention in each stage:

Conv Stages Attention Stages Top-1 Acc (%) Norm. Train Time
- 1, 2, 3, 4 84.9 1.9
1 2, 3, 4 84.6 1.4
1, 2 3, 4 84.7 1.0
1, 2, 3 4 83.8 0.5

Usage

from keras_cv_attention_models import halonet

# Will download and load pretrained imagenet weights.
mm = halonet.HaloNet26T(pretrained="imagenet")

# Run prediction
import tensorflow as tf
from tensorflow import keras
from skimage.data import chelsea
imm = keras.applications.imagenet_utils.preprocess_input(chelsea(), mode='torch') # Chelsea the cat
pred = mm(tf.expand_dims(tf.image.resize(imm, mm.input_shape[1:3]), 0)).numpy()
print(keras.applications.imagenet_utils.decode_predictions(pred)[0])
# [('n02124075', 'Egyptian_cat', 0.8999013),
#  ('n02123159', 'tiger_cat', 0.012704549),
#  ('n02123045', 'tabby', 0.009713952),
#  ('n07760859', 'custard_apple', 0.00056676986),
#  ('n02487347', 'macaque', 0.00050636294)]