mirror of
https://github.com/open-mmlab/mmdeploy.git
synced 2025-01-14 08:09:43 +08:00
* add java classifier detector * add segmentor * fix lint * add ImageRestorer java apis and demo * remove useless count parameter for Segmentor and Restorer, add PoseDetector * add RotatedDetection java api and demo * add Ocr java demo and apis * remove mmrotate ncnn java api and demo * fix lint * sync java api folder after rebase to master * fix include * remove record * fix java apis dir path in cmake * add java demo readme * fix lint mdformat * add test javaapi ci * fix lint * fix flake8 * fix test javaapi ci * refactor readme.md * fix install opencv for ci * fix install opencv : add permission * add all codebases and mmcv install * add torch * install mmdeploy * fix image path * fix picture path * fix import ncnn * fix import ncnn * add submodule of pybind * fix pybind submodule * change download to git clone for submodule * fix ncnn dir * fix README error * simplify the github ci * fix ci * fix yapf * add JNI as required * fix Capitalize * fix Capitalize * fix copyright * ignore .class changed * add OpenJDK installation docs * install target of javaapi * simplify ci * add jar * fix ci * fix ci * fix test java command * debugging what failed * debugging what failed * debugging what failed * add java version info * install openjdk * add java env var * fix export * fix export * fix export * fix export * fix picture path * fix picture path * fix file name * fix file name * fix README * remove java_api strategy * fix python version * format task name * move args position * extract common utils code * show image class result * add detector result * segmentation result format * add ImageRestorer result * add PoseDetection java result format * fix ci * stage ocr * add visualize * move utils * fix lint * fix ocr bugs * fix ci demo * fix java classpath for ci * fix popd * fix ocr demo text garbled * fix ci * fix ci * fix ci * fix path of utils ci
85 lines
2.7 KiB
Python
85 lines
2.7 KiB
Python
# Copyright (c) OpenMMLab. All rights reserved.
|
|
|
|
import os
|
|
|
|
# list of dict: task name and deploy configs.
|
|
|
|
PARAMS = [
|
|
{
|
|
'task':
|
|
'ImageClassification',
|
|
'configs': [
|
|
'https://media.githubusercontent.com/media/hanrui1sensetime/mmdeploy-javaapi-testdata/master/resnet.tar' # noqa: E501
|
|
]
|
|
},
|
|
{
|
|
'task':
|
|
'ObjectDetection',
|
|
'configs': [
|
|
'https://media.githubusercontent.com/media/hanrui1sensetime/mmdeploy-javaapi-testdata/master/mobilessd.tar' # noqa: E501
|
|
]
|
|
},
|
|
{
|
|
'task':
|
|
'ImageSegmentation',
|
|
'configs': [
|
|
'https://media.githubusercontent.com/media/hanrui1sensetime/mmdeploy-javaapi-testdata/master/fcn.tar' # noqa: E501
|
|
]
|
|
},
|
|
{
|
|
'task':
|
|
'ImageRestorer',
|
|
'configs': [
|
|
'https://media.githubusercontent.com/media/hanrui1sensetime/mmdeploy-javaapi-testdata/master/srcnn.tar' # noqa: E501
|
|
]
|
|
},
|
|
{
|
|
'task':
|
|
'Ocr',
|
|
'configs': [
|
|
'https://media.githubusercontent.com/media/hanrui1sensetime/mmdeploy-javaapi-testdata/master/dbnet.tar', # noqa: E501
|
|
'https://media.githubusercontent.com/media/hanrui1sensetime/mmdeploy-javaapi-testdata/master/crnn.tar' # noqa: E501
|
|
]
|
|
},
|
|
{
|
|
'task':
|
|
'PoseDetection',
|
|
'configs': [
|
|
'https://media.githubusercontent.com/media/hanrui1sensetime/mmdeploy-javaapi-testdata/master/litehrnet.tar' # noqa: E501
|
|
]
|
|
}
|
|
]
|
|
|
|
|
|
def main():
|
|
"""test java apis and demos.
|
|
|
|
Run all java demos for test.
|
|
"""
|
|
|
|
for params in PARAMS:
|
|
task = params['task']
|
|
configs = params['configs']
|
|
java_demo_cmd = [
|
|
'java', '-cp', 'csrc/mmdeploy/apis/java:demo/java',
|
|
'demo/java/' + task + '.java', 'cpu'
|
|
]
|
|
for config in configs:
|
|
model_url = config
|
|
os.system('wget {} && tar xvf {}'.format(model_url,
|
|
model_url.split('/')[-1]))
|
|
model_dir = model_url.split('/')[-1].split('.')[0]
|
|
java_demo_cmd.append(model_dir)
|
|
java_demo_cmd.append('/home/runner/work/mmdeploy/mmdeploy/demo' +
|
|
'/resources/human-pose.jpg')
|
|
java_demo_cmd_str = ' '.join(java_demo_cmd)
|
|
os.system('export JAVA_HOME=/home/runner/work/mmdeploy/mmdeploy/' +
|
|
'jdk-18 && export PATH=${JAVA_HOME}/bin:${PATH} && java' +
|
|
' --version && export LD_LIBRARY_PATH=/home/runner/work/' +
|
|
'mmdeploy/mmdeploy/build/lib:${LD_LIBRARY_PATH} && ' +
|
|
java_demo_cmd_str)
|
|
|
|
|
|
if __name__ == '__main__':
|
|
main()
|