EasyCV/easycv/utils/import_utils.py
Cathy0908 7f08eb6b3f
merge internal master 20221027 (#216)
* avoid numpy version check when xtcocotools can be imported 

Link: https://code.alibaba-inc.com/pai-vision/EasyCV/codereview/10377599

* * move thirdparty into easycv
 * fix code style
        Link: https://code.alibaba-inc.com/pai-vision/EasyCV/codereview/10395748

    * move thirdparty into easycv

* fix missing thirdparty/deformable_attention/src when build package

* optimize ci_test

* update version to 0.6.3.8 
        Link: https://code.alibaba-inc.com/pai-vision/EasyCV/codereview/10412059

    * update version to 0.6.3.8

* fix face keypoints bugs in FT

* update version to 0.6.3.9 
        Link: https://code.alibaba-inc.com/pai-vision/EasyCV/codereview/10443200

    * update version to 0.6.3.9

* fix import thirdparty

* fix unittest

* fix unittest

Co-authored-by: wenmeng.zwm <wenmeng.zwm@alibaba-inc.com>
Co-authored-by: shouzhou.bx <shouzhou.bx@alibaba-inc.com>
2022-11-01 10:48:12 +08:00

31 lines
704 B
Python

# Copyright (c) Alibaba, Inc. and its affiliates.
import sys
from distutils.version import LooseVersion
import numpy as np
def check_numpy():
# if use xtcocotools which support lower version of numpy
# skip check
try:
import xtcocotools
except ModuleNotFoundError:
return
try:
from xtcocotools.coco import COCO
return
except ValueError as e:
pass
def require(version):
if LooseVersion(np.__version__) < LooseVersion(version):
raise ImportError(
f'numpy version should be greater than {version}')
if sys.version_info.minor == 6:
require('1.19.5')
else:
require('1.20.0')