Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# EfficientWord-Net
![Versions : 3.6 ,3.7,3.8,3.9](https://camo.githubusercontent.com/a7b5b417de938c1faf3602c7f48f26fde8761a977be85390fd6c0d191e210ba8/68747470733a2f2f696d672e736869656c64732e696f2f707970692f707976657273696f6e732f74656e736f72666c6f772e7376673f7374796c653d706c6173746963)
![Versions : 3.8, 3.9, 3.10, 3.11, 3.12](https://camo.githubusercontent.com/a7b5b417de938c1faf3602c7f48f26fde8761a977be85390fd6c0d191e210ba8/68747470733a2f2f696d672e736869656c64732e696f2f707970692f707976657273696f6e732f74656e736f72666c6f772e7376673f7374796c653d706c6173746963)

## Hotword detection based on few-shot learning

Expand All @@ -25,7 +25,7 @@ Here are the links: https://drive.google.com/file/d/1f6dp72D9WxErXvaZP6KIBLv4-eK
## Python Version Requirements

This Library works between python versions:
`3.6 to 3.9`
`3.8 to 3.12`
<br>

## Dependencies Installation
Expand All @@ -37,6 +37,7 @@ Before running the pip installation command for the library, few dependencies ne
Mac OS M* and Raspberry Pi users might have to compile these dependecies.

***tflite*** package cannot be listed in requirements.txt hence will be automatically installed when the package is initialized in the system.
On Windows and Mac, use tensorflow instead.

***librosa*** package is not required for inference only cases , however when generate_reference is called , will be automatically installed.

Expand Down
9 changes: 6 additions & 3 deletions eff_word_net/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@
"""

import os
from eff_word_net.package_installation_scripts import is_arm_cpu


RATE=16000
samples_loc = os.path.join(os.path.dirname(os.path.realpath(__file__)),"sample_refs")

from eff_word_net.package_installation_scripts import check_install_tflite

check_install_tflite()
if is_arm_cpu():
from eff_word_net.package_installation_scripts import check_install_tflite
check_install_tflite()
8 changes: 6 additions & 2 deletions eff_word_net/audio_processing.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import glob
import tflite_runtime.interpreter as tflite
from eff_word_net.package_installation_scripts import is_arm_cpu

if is_arm_cpu():
import tflite_runtime.interpreter as tflite
else:
from tensorflow import lite as tflite
import os
import numpy as np
import random
Expand Down
14 changes: 14 additions & 0 deletions eff_word_net/package_installation_scripts.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,17 @@ def check_install_librosa(verbose=False, upgrade=False, force=False, **kw):
print('.'*50)
print('All done! Carry on.')

def is_arm_cpu():
"""
Check if the CPU architecture is ARM.

This function determines whether the current system is running on
an ARM CPU by inspecting the machine architecture string provided
by the platform module.

Returns:
bool: True if the CPU is ARM, False otherwise.
"""
import platform
architecture = platform.machine()
return architecture.startswith('arm') or architecture.startswith('aarch')
8 changes: 4 additions & 4 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
numpy==1.24.0
onnxruntime==1.15.1
PyAudio==0.2.13
requests==2.26.0
numpy>=1.22.0
onnxruntime>=1.14.1
PyAudio>=0.2.13
requests>=2.26.0
56 changes: 40 additions & 16 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,46 @@
from setuptools import setup
from glob import glob
from setuptools import setup, find_packages

with open("README.md", "r", encoding="utf-8") as fh:
long_description = fh.read()

with open("requirements.txt", "r", encoding="utf-8") as fr:
requirements = fr.read().splitlines()

def is_arm_cpu():
"""
Check if the CPU architecture is ARM.

This function determines whether the current system is running on
an ARM CPU by inspecting the machine architecture string provided
by the platform module.

Returns:
bool: True if the CPU is ARM, False otherwise.
"""
import platform
architecture = platform.machine()
return architecture.startswith('arm') or architecture.startswith('aarch')

if not is_arm_cpu():
requirements.append("tensorflow>=2.13.0")

setup(
name = 'EfficientWord-Net',
version = '1.0.2',
description = 'Few Shot Learning based Hotword Detection Engine',
long_description = open("./README.md",'r').read(),
long_description_content_type = 'text/markdown',
url = 'https://github.com/Ant-Brain/EfficientWord',
#py_modules = ['efficientword'],
packages = ['eff_word_net'],
install_requires = open("./requirements.txt",'r').read().split("\n"),
classifiers = [
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
name='EfficientWord-Net',
version='1.1.1',
description='Few Shot Learning based Hotword Detection Engine',
long_description=long_description,
long_description_content_type='text/markdown',
url='https://github.com/Ant-Brain/EfficientWord',
packages=find_packages(),
install_requires=requirements,
classifiers=[
'License :: OSI Approved :: Apache Software License',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
],
python_requires='>=3.8',
include_package_data=True,
)

)