MobileNet V2

pip install vectorhub[encoders-image-tfhub]

Details

Example

#pip install vectorhub[encoders-image-tfhub]
from vectorhub.encoders.image.tfhub import MobileNetV22Vec
model = MobileNetV22Vec()
sample = model.read('https://getvectorai.com/assets/hub-logo-with-text.png')
model.encode(sample)

Index and search vectors

Index and search your vectors easily on the cloud using 1 line of code!

username = '<your username>'
email = '<your email>'
# You can request an api_key using - type in your username and email.
api_key = model.request_api_key(username, email)

# Index in 1 line of code
items = ['https://getvectorai.com/_nuxt/img/rabbit.4a65d99.png', 'https://getvectorai.com/_nuxt/img/dog-2.b8b4cef.png', 'https://getvectorai.com/_nuxt/img/dog-1.3cc5fe1.png']
model.add_documents(user, api_key, items)

# Search in 1 line of code and get the most similar results.
model.search('https://getvectorai.com/_nuxt/img/dog-1.3cc5fe1.png')

# Add metadata to your search
metadata = [{'animal': 'rabbit', 'hat': 'no'}, {'animal': 'dog', 'hat': 'yes'}, {'animal': 'dog', 'hat': 'yes'}]
model.add_documents(user, api_key, items, metadata=metadata)

Description

We present a class of efficient models called MobileNets for mobile and embedded vision applications. MobileNets are based on a streamlined architecture that uses depth-wise separable convolutions to build light weight deep neural networks. We introduce two simple global hyper-parameters that efficiently trade off between latency and accuracy. These hyper-parameters allow the model builder to choose the right sized model for their application based on the constraints of the problem. We present extensive experiments on resource and accuracy tradeoffs and show strong performance compared to other popular models on ImageNet classification. We then demonstrate the effectiveness of MobileNets across a wide range of applications and use cases including object detection, finegrain classification, face attributes and large scale geo-localization.

Working in Colab

If you are using this in colab and want to save this so you don't have to reload, use:

import os 
os.environ['TFHUB_CACHE_DIR'] = "drive/MyDrive/"
os.environ["TFHUB_MODEL_LOAD_FORMAT"] = "COMPRESSED"