From dab1f6324164adc351631c4b0fa467d67970e2b7 Mon Sep 17 00:00:00 2001 From: Simba Zhang Date: Tue, 27 Sep 2022 11:30:56 -0700 Subject: [PATCH] add arm64 support for yolov7_reid --- setup.py | 2 +- src/sharpai_hub/commands/yolov7_reid.py | 3 --- src/sharpai_hub/utils/check_env.py | 23 +++++++++++++++++++++-- 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/setup.py b/setup.py index 66f690b..5f8d71d 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ def get_version() -> str: - return "0.1.35" + return "0.1.36" install_requires = [ "requests", diff --git a/src/sharpai_hub/commands/yolov7_reid.py b/src/sharpai_hub/commands/yolov7_reid.py index 93d478c..161dd3c 100644 --- a/src/sharpai_hub/commands/yolov7_reid.py +++ b/src/sharpai_hub/commands/yolov7_reid.py @@ -160,9 +160,6 @@ def run(self): if docker_compose_yml == None: print('Your platform is not supported, please file an issue on github for feature request: https://github.com/SharpAI/DeepCamera/issues') exit(-1) - if docker_compose_yml != 'docker-compose-x86.yml': - print('Only support X86 platform, please file an issue on github for feature request: https://github.com/SharpAI/DeepCamera/issues') - exit(-1) yml_url = f'https://raw.githubusercontent.com/SharpAI/applications/main/yolov7_reid/{docker_compose_yml}' response=requests.get(yml_url) diff --git a/src/sharpai_hub/utils/check_env.py b/src/sharpai_hub/utils/check_env.py index 581577a..a39747c 100644 --- a/src/sharpai_hub/utils/check_env.py +++ b/src/sharpai_hub/utils/check_env.py @@ -1,3 +1,5 @@ +import io +import os import subprocess from shutil import which import platform @@ -29,6 +31,21 @@ def check_if_docker_has_permission(): print('logout/login your account, if there\'s issue still, please reboot') #print(output) exit(-1) +def is_raspberrypi(): + if os.name != 'posix': + return False + chips = ('BCM2708','BCM2709','BCM2711','BCM2835','BCM2836') + try: + with io.open('/proc/cpuinfo', 'r') as cpuinfo: + for line in cpuinfo: + if line.startswith('Hardware'): + _, value = line.strip().split(':', 1) + value = value.strip() + if value in chips: + return True + except Exception: + pass + return False def get_docker_compose_arch_filename(): processor = platform.processor() # print(processor) @@ -54,7 +71,9 @@ def get_docker_compose_arch_filename(): docker_compose_yml = 'docker-compose-l4t-r32.6.1.yml' elif version[0] == '5' and version[1]=='0': docker_compose_yml = 'docker-compose-l4t-r35.1.0.yml' - else: - print(f'Your platform dose not support yet, please file a bug: {subprocess.getoutput("apt show nvidia-jetpack")}') + elif is_raspberrypi(): + docker_compose_yml = 'docker-compose-arm64.yml' + else: + print(f'Your platform dose not support yet, please file a bug: {subprocess.getoutput("apt show nvidia-jetpack")}') return docker_compose_yml