Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rv master #1441

Open
wants to merge 101 commits into
base: tengine-lite
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
101 commits
Select commit Hold shift + click to select a range
aaa9d99
fix riscv64 c906
ComingToy Jun 18, 2023
8016d47
Merge remote-tracking branch 'upstream/tengine-lite' into c906_fix
ComingToy Jun 22, 2023
a2b0cd2
add im2col_til8
ComingToy Dec 24, 2023
86e0811
fix rvv
ComingToy Dec 24, 2023
a4ed83f
Merge pull request 'im2col_tile8' (#3) from im2col_tile8 into tengine…
Dec 24, 2023
621a975
fix vulkan
ComingToy Dec 28, 2023
c79121d
clean up
ComingToy Dec 28, 2023
8a2a0a3
fix input node
ComingToy Dec 29, 2023
a06d1e9
disable fp16
ComingToy Dec 29, 2023
aabaf9f
fix fp16 storage
ComingToy Dec 29, 2023
862b333
fix memory release
ComingToy Dec 29, 2023
519da20
clean up
ComingToy Dec 29, 2023
39dc63d
fix flaten
ComingToy Dec 31, 2023
763c97e
fix reshape / elementwise op
ComingToy Jan 1, 2024
81384b2
fix retinaface
ComingToy Jan 9, 2024
04aa41e
fix gpu device
ComingToy Jan 9, 2024
960d790
support interp and crop layer
ComingToy Jan 10, 2024
4fa3638
add landmark vulkan example
ComingToy Jan 10, 2024
83bc7f3
get input tensor using graph api
ComingToy Jan 10, 2024
69f8672
Merge pull request 'vulkan' (#5) from vulkan into tengine-lite
Jan 10, 2024
71dce17
conv dw packn
ComingToy Jan 15, 2024
cae9107
Merge pull request 'conv dw packn' (#6) from rv-dw into tengine-lite
Jan 21, 2024
f0d7aec
fix compile
ComingToy Jan 22, 2024
7604b5d
fix s2 pack8 sgement fault
ComingToy Jan 22, 2024
7ebe8c8
Merge pull request 'fix compile' (#7) from rv-dw into tengine-lite
Jan 22, 2024
b07a387
fix compile
ComingToy Jan 23, 2024
ae99e7e
add drone.yml
ComingToy Jan 23, 2024
e04cc2a
move FIX C906 option to toolchain file
ComingToy Jan 25, 2024
d113b5b
add test rv64
ComingToy Jan 25, 2024
2626abf
fix im2col_fp32 boundary
ComingToy Jan 27, 2024
898f51d
fix rv64 squeezenet
ComingToy Jan 28, 2024
0f8d606
cicd: build tests
ComingToy Jan 28, 2024
6e554e9
cicd: no voerbose
ComingToy Jan 28, 2024
45f6886
rv64 more test cases
ComingToy Jan 28, 2024
87bfdba
rv64 more test cases
ComingToy Jan 28, 2024
c0c5aaf
fix ci data
ComingToy Jan 28, 2024
ea54a66
fix ci data
ComingToy Jan 28, 2024
2b13aaf
fix dw bias
ComingToy Jan 28, 2024
e80d86a
fix sgemm 8x8
ComingToy Jan 29, 2024
36aaa78
easy bound
ComingToy Jan 30, 2024
f24f655
easy bound
ComingToy Jan 30, 2024
328a5f8
add codecov
ComingToy Jan 31, 2024
e6390e0
remove deprecated code
ComingToy Jan 31, 2024
2ef3953
deploy codecov
ComingToy Jan 31, 2024
e859746
remove deprecated code
ComingToy Feb 2, 2024
1652045
add node_ops::is_ref_op
ComingToy Feb 2, 2024
c21161d
add node_ops::is_ref_op
ComingToy Feb 2, 2024
e9dd762
upload to codecov
ComingToy Feb 3, 2024
f2adc72
update badges
ComingToy Feb 3, 2024
73b600c
Merge pull request 'dev' (#10) from dev into master
Feb 3, 2024
52f3773
upload to codecov
ComingToy Feb 3, 2024
b4382e0
update badges
ComingToy Feb 3, 2024
6c1f234
add op test cases
ComingToy Feb 5, 2024
35ae3b9
remove deprecated code
ComingToy Feb 6, 2024
41b742f
add absval test case
ComingToy Feb 6, 2024
09a0518
test case: multiple input tensor
ComingToy Feb 6, 2024
01326dd
add add_n op test case
ComingToy Feb 6, 2024
7c612d3
refactored test cases
ComingToy Feb 6, 2024
f779afb
refactored test cases
ComingToy Feb 6, 2024
ba31290
add argmin test case
ComingToy Feb 7, 2024
3a27aad
scp codecov to server
ComingToy Feb 7, 2024
d893d3f
add batchnorm test case
ComingToy Feb 7, 2024
cd6d987
add batchnorm uint8 test case
ComingToy Feb 8, 2024
d462078
add argmin/argmax uint8 test case
ComingToy Feb 8, 2024
5e31d7b
fix argmin/argmax uint8
ComingToy Feb 8, 2024
0325578
fix argmin/argmax test case
ComingToy Feb 8, 2024
ce77e88
add batchtospacend test case
ComingToy Feb 9, 2024
9cb82b0
add bias op test case
ComingToy Feb 9, 2024
805fa51
add broadmul test case
ComingToy Feb 10, 2024
1e6cb78
remove deprecated code
ComingToy Feb 11, 2024
d51bb34
check dims
ComingToy Feb 11, 2024
958e82d
setup random seed
ComingToy Feb 11, 2024
b981c6e
test failed.
ComingToy Feb 11, 2024
77e0bd3
add cast op test case
ComingToy Feb 12, 2024
d9cb15e
fix ceil op
ComingToy Feb 12, 2024
bbf6a98
add ceil op test
ComingToy Feb 12, 2024
262d740
fix ceil op
ComingToy Feb 12, 2024
d473b85
add ceil op test
ComingToy Feb 12, 2024
4acbd69
add clip op test
ComingToy Feb 12, 2024
29ceea2
fix batchtospacend test case
ComingToy Feb 12, 2024
1a8127b
add cast op test
ComingToy Feb 13, 2024
4a32765
bug: broadmul_ref op
ComingToy Feb 14, 2024
05d218e
fix ceil op
ComingToy Feb 14, 2024
5e5767e
add fp32 to fp16
ComingToy Feb 14, 2024
d5b8238
add fp32 to fp16
ComingToy Feb 14, 2024
23ff00e
add comparison op test case
ComingToy Feb 14, 2024
0d804a5
add conv op test case
ComingToy Feb 16, 2024
3ea23f4
fix conv
ComingToy Feb 16, 2024
71e1983
Merge branch 'master' of https://git.conleylee.com/conley/Tengine int…
ComingToy Feb 16, 2024
ead15cd
1. fix comparison op 2. add comparison test case
ComingToy Feb 16, 2024
8a041aa
Merge pull request 'test' (#12) from test into master
Feb 16, 2024
125cea4
fix comparison op
ComingToy Feb 16, 2024
05cbbf6
split test cases into ops and models
ComingToy Feb 17, 2024
05ddf28
bug(ci): fix ci error
ComingToy Feb 25, 2024
7af0113
Merge pull request 'test' (#13) from test into master
Feb 25, 2024
2baad6d
Merge branch 'master' into dev
ComingToy Feb 25, 2024
7b066c5
feat(ci): update download server
ComingToy Feb 25, 2024
1295e5c
bug(ci): fix ci error
ComingToy Feb 25, 2024
3c8d4ce
feat(format): format all code
ComingToy Feb 25, 2024
d489e04
feat(ops): add add_n_hcl_rv64 op
ComingToy Feb 25, 2024
cb39e8f
Merge pull request 'dev' (#14) from dev into master
Feb 25, 2024
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
81 changes: 81 additions & 0 deletions .drone.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
---
kind: pipeline
name: TengineRV64
platform:
os: linux
arch: amd64

steps:
- name: build
image: ubuntu20.04:qemu
commands:
- PATH=$PATH:/home/riscv/bin cmake -DCMAKE_TOOLCHAIN_FILE=toolchains/rv64-c906.toolchain.cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_BUILD_TYPE=RELEASE -DTENGINE_BUILD_TESTS=ON -DTENGINE_COVERAGE=ON -B build
- PATH=$PATH:/home/riscv/bin cmake --build build -- -j`cat /proc/cpuinfo | grep 'processor' | wc -l` VERBOSE=1
- name: test ops
image: ubuntu20.04:qemu
commands:
- cd build
- export QEMU_CMD='qemu-riscv64 -cpu rv64,v=true -E TG_DEBUG_TIME=1 -L /home/riscv/sysroot'
- ../tests/test_rv64_ops.sh
- name: test models
image: ubuntu20.04:qemu
environment:
DATA_SERVER_URL:
from_secret: DATA_SERVER_URL
commands:
- cd build
- wget -nv $${DATA_SERVER_URL}/tengine_model_zoo/ci_data/models.tar.gz
- wget -nv $${DATA_SERVER_URL}/tengine_model_zoo/ci_data/images.tar.gz
- wget -nv $${DATA_SERVER_URL}/tengine_model_zoo/ci_data/data_x86.tar.gz
- mkdir models images data
- tar zxvf models.tar.gz -C models
- tar zxvf images.tar.gz -C images
- tar zxvf data_x86.tar.gz -C data
- export QEMU_CMD='qemu-riscv64 -cpu rv64,v=true -E TG_DEBUG_TIME=1 -L /home/riscv/sysroot'
- ../tests/test_rv64_models.sh
when:
branch:
- master
- name: code coverage
image: ubuntu20.04:qemu
commands:
- cd build
- apt update && apt install lcov -y
- lcov --gcov-tool /home/riscv/bin/riscv64-unknown-linux-gnu-gcov --capture --directory . --output-file $${DRONE_REPO_NAME}.info
- genhtml --branch-coverage -o ../codecov $${DRONE_REPO_NAME}.info
- name: scp files
image: appleboy/drone-scp
settings:
host: conleylee.com
username:
from_secret: download_host_user
password:
from_secret: download_host_passwd
port: 38000
target: /home/lee/codecov/${DRONE_REPO_NAME}/${DRONE_BUILD_NUMBER}/${DRONE_COMMIT_SHA}
strip_components: 1
source: codecov/*
- name: upload_to_codecov
image: robertstettner/drone-codecov:latest
settings:
token:
from_secret: CODECOV_TOKEN
files:
- build/${DRONE_REPO_NAME}.info
flags:
- model_test
- name: notify
image: ubuntu20.04:drone_script
environment:
MATTERMOST_TOKEN:
from_secret: MATTERMOST_TOKEN
GITEA_API_TOKEN:
from_secret: gitea_api_token
commands:
- 'export DRONE_SCRIPT_DOWNLOAD_LINK=https://download.conleylee.com/scripts/drone_bot.py'
- 'export DRONE_CODECOV_LINK=https://codecov.conleylee.com/$${DRONE_REPO_NAME}/$${DRONE_BUILD_NUMBER}/$${DRONE_COMMIT_SHA}'
- 'wget $${DRONE_SCRIPT_DOWNLOAD_LINK}'
- pip3 install mattermostdriver
- python3 `basename $${DRONE_SCRIPT_DOWNLOAD_LINK}`
when:
status: [success, failure]
30 changes: 17 additions & 13 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,6 @@ ENDIF()
# Enable the languages which in use
ENABLE_LANGUAGE (C CXX)

IF (CMAKE_TOOLCHAIN_FILE)
SET (LIBRARY_OUTPUT_PATH_ROOT ${CMAKE_BINARY_DIR} CACHE PATH "root for library output, set this to change where android libs are compiled to")

# get absolute path, but get_filename_component ABSOLUTE only refer with source dir, so find_file here :(
GET_FILENAME_COMPONENT (CMAKE_TOOLCHAIN_FILE_NAME ${CMAKE_TOOLCHAIN_FILE} NAME)
FIND_FILE (CMAKE_TOOLCHAIN_FILE ${CMAKE_TOOLCHAIN_FILE_NAME} PATHS ${CMAKE_SOURCE_DIR} NO_DEFAULT_PATH)
MESSAGE (STATUS "Using CMake tool chain file ${CMAKE_TOOLCHAIN_FILE}")
ENDIF()

IF (NOT CMAKE_BUILD_TYPE)
SET (CMAKE_BUILD_TYPE release CACHE STRING "Choose the type of build" FORCE)
ENDIF()

# Module options
OPTION (TENGINE_BUILD_BENCHMARK "Build benchmark" ON)
Expand Down Expand Up @@ -92,7 +80,23 @@ OPTION (TENGINE_ENABLE_ALL_SYMBOL "All symbol visible"
OPTION (TENGINE_ENABLE_MODEL_CACHE "NPU kernel cache file option" OFF)

# Online report
OPTION (TENGINE_ONLINE_REPORT "online report" ON)
OPTION (TENGINE_ONLINE_REPORT "online report" OFF)

OPTION (TENGINE_RV64_RVV_C906 "build for c906" OFF)
OPTION (TENGINE_COVERAGE "build with coverage info" OFF)

IF (CMAKE_TOOLCHAIN_FILE)
SET (LIBRARY_OUTPUT_PATH_ROOT ${CMAKE_BINARY_DIR} CACHE PATH "root for library output, set this to change where android libs are compiled to")

# get absolute path, but get_filename_component ABSOLUTE only refer with source dir, so find_file here :(
GET_FILENAME_COMPONENT (CMAKE_TOOLCHAIN_FILE_NAME ${CMAKE_TOOLCHAIN_FILE} NAME)
FIND_FILE (CMAKE_TOOLCHAIN_FILE ${CMAKE_TOOLCHAIN_FILE_NAME} PATHS ${CMAKE_SOURCE_DIR} NO_DEFAULT_PATH)
MESSAGE (STATUS "Using CMake tool chain file ${CMAKE_TOOLCHAIN_FILE}")
ENDIF()

IF (NOT CMAKE_BUILD_TYPE)
SET (CMAKE_BUILD_TYPE release CACHE STRING "Choose the type of build" FORCE)
ENDIF()

# Do check list
INCLUDE ("${CMAKE_CURRENT_SOURCE_DIR}/cmake/check.cmake")
Expand Down
8 changes: 3 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,9 @@

# Tengine

[![GitHub license](http://OAID.github.io/pics/apache_2.0.svg)](./LICENSE)
[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/OAID/Tengine/build-and-test.yml?branch=tengine-lite)](https://github.com/OAID/Tengine/actions)
[![Test Status](https://img.shields.io/travis/OAID/Tengine/tengine-lite?label=test)](https://travis-ci.org/OAID/Tengine)
[![codecov](https://codecov.io/gh/OAID/Tengine/branch/tengine-lite/graph/badge.svg?token=kz9NcQPRrk)](https://codecov.io/gh/OAID/Tengine)
[![Language grade: C/C++](https://img.shields.io/lgtm/grade/cpp/g/OAID/Tengine.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/OAID/Tengine/context:cpp)
[![License](https://img.shields.io/badge/license-Apache_2.0-blue)](./LICENSE)
[![Build Status](https://drone.conleylee.com/api/badges/conley/Tengine/status.svg?ref=refs/heads/master)](https://drone.conleylee.com/conley/Tengine)
[![codecov](https://codecov.io/gh/ComingToy/Tengine/graph/badge.svg?token=KVOX0LW1NJ)](https://codecov.io/gh/ComingToy/Tengine)


## 简介
Expand Down
10 changes: 3 additions & 7 deletions README_EN.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,9 @@ English | [简体中文](./README.md)

# Tengine

[![GitHub license](http://OAID.github.io/pics/apache_2.0.svg)](./LICENSE)
[![Build Status](https://img.shields.io/github/workflow/status/OAID/Tengine/Tengine-Lite-Actions/tengine-lite)](https://github.com/OAID/Tengine/actions?query=workflow%3ATengine-Lite-Actions)
[![Build Status](https://img.shields.io/github/workflow/status/OAID/Tengine-Convert-Tools/Tengine-Convert-Tools-Actions?label=tools%20build)](https://github.com/OAID/Tengine-Convert-Tools/actions?query=workflow%3ATengine-Convert-Tools-Actions)
[![Test Status](https://img.shields.io/travis/OAID/Tengine/tengine-lite?label=test)](https://travis-ci.org/OAID/Tengine)
[![codecov](https://codecov.io/gh/OAID/Tengine/branch/tengine-lite/graph/badge.svg?token=kz9NcQPRrk)](https://codecov.io/gh/OAID/Tengine)
[![Language grade: C/C++](https://img.shields.io/lgtm/grade/cpp/g/OAID/Tengine.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/OAID/Tengine/context:cpp)

[![License](https://img.shields.io/badge/license-Apache_2.0-blue)](./LICENSE)
[![Build Status](https://drone.conleylee.com/api/badges/conley/Tengine/status.svg?ref=refs/heads/master)](https://drone.conleylee.com/conley/Tengine)
[![codecov](https://codecov.io/gh/ComingToy/Tengine/graph/badge.svg?token=KVOX0LW1NJ)](https://codecov.io/gh/ComingToy/Tengine)

## Introduction

Expand Down
2 changes: 2 additions & 0 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@ TENGINE_EXAMPLE (tm_efficientdet_uint8 tm_efficientdet_uint8.c)
TENGINE_EXAMPLE (tm_mobilenet_ssd tm_mobilenet_ssd.c)
TENGINE_EXAMPLE (tm_mobilenet_ssd_uint8 tm_mobilenet_ssd_uint8.cpp)
TENGINE_EXAMPLE (tm_retinaface tm_retinaface.cpp)
TENGINE_EXAMPLE (tm_retinaface_vulkan tm_retinaface_vulkan.cpp)
TENGINE_EXAMPLE (tm_landmark tm_landmark.cpp)
TENGINE_EXAMPLE (tm_landmark_vulkan tm_landmark_vulkan.cpp)
TENGINE_EXAMPLE (tm_landmark_uint8 tm_landmark_uint8.cpp)
TENGINE_EXAMPLE (tm_mobilefacenet tm_mobilefacenet.cpp)
TENGINE_EXAMPLE (tm_mobilefacenet_uint8 tm_mobilefacenet_uint8.cpp)
Expand Down
206 changes: 206 additions & 0 deletions examples/tm_landmark_vulkan.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,206 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* License); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

/*
* Copyright (c) 2020, OPEN AI LAB
* Author: qtang@openailab.com
*/

#include <iostream>
#include <functional>

#include "common.h"
#include "tengine/c_api.h"
#include "tengine_operations.h"

#define DEFAULT_REPEAT_COUNT 1
#define DEFAULT_THREAD_COUNT 1

void get_input_fp32_data(const char* image_file, float* input_data, int img_h, int img_w, float* mean, float* scale)
{
image img = imread_process(image_file, img_w, img_h, mean, scale);

float* image_data = (float*)img.data;

for (int i = 0; i < img_w * img_h * 3; i++)
input_data[i] = image_data[i];

free_image(img);
}

void show_usage()
{
fprintf(stderr, "[Usage]: [-h]\n [-m model_file] [-i image_file] [-r repeat_count] [-t thread_count]\n");
}

int main(int argc, char* argv[])
{
int repeat_count = DEFAULT_REPEAT_COUNT;
int num_thread = DEFAULT_THREAD_COUNT;
char* model_file = nullptr;
char* image_file = nullptr;
int img_h = 144;
int img_w = 144;
float mean[3] = {128.f, 128.f, 128.f};
float scale[3] = {0.0039, 0.0039, 0.0039};

int res;
while ((res = getopt(argc, argv, "m:i:r:t:h:")) != -1)
{
switch (res)
{
case 'm':
model_file = optarg;
break;
case 'i':
image_file = optarg;
break;
case 'r':
repeat_count = atoi(optarg);
break;
case 't':
num_thread = atoi(optarg);
break;
case 'h':
show_usage();
return 0;
default:
break;
}
}

/* check files */
if (model_file == nullptr)
{
fprintf(stderr, "Error: Tengine model file not specified!\n");
show_usage();
return -1;
}

if (image_file == nullptr)
{
fprintf(stderr, "Error: Image file not specified!\n");
show_usage();
return -1;
}

if (!check_file_exist(model_file) || !check_file_exist(image_file))
return -1;

/* set runtime options */
struct options opt;
opt.num_thread = num_thread;
opt.cluster = TENGINE_CLUSTER_ALL;
opt.precision = TENGINE_MODE_FP32;
opt.affinity = 0;

/* inital tengine */
init_tengine();
fprintf(stderr, "tengine-lite library version: %s\n", get_tengine_version());

/* create graph, load tengine model xxx.tmfile */
context_t vk_context = create_context("VK", 1);
add_context_device(vk_context, "VK");
graph_t graph = create_graph(vk_context, "tengine", model_file);
set_graph_device(graph, "VK");
if (graph == nullptr)
{
std::cout << "Create graph0 failed\n";
return -1;
}

/* set the input shape to initial the graph, and prerun graph to infer shape */
int img_size = img_h * img_w * 3;
int dims[] = {1, 3, img_h, img_w}; // nchw
float* input_data = (float*)malloc(img_size * sizeof(float));

tensor_t input_tensor = get_graph_input_tensor(graph, 0, 0);
if (input_tensor == nullptr)
{
fprintf(stderr, "Get input tensor failed\n");
return -1;
}

if (set_tensor_shape(input_tensor, dims, 4) < 0)
{
fprintf(stderr, "Set input tensor shape failed\n");
return -1;
}

if (set_tensor_buffer(input_tensor, input_data, img_size * sizeof(float)) < 0)
{
fprintf(stderr, "Set input tensor buffer failed\n");
return -1;
}

/* prerun graph, set work options(num_thread, cluster, precision) */
if (prerun_graph_multithread(graph, opt) < 0)
{
fprintf(stderr, "Prerun multithread graph failed.\n");
return -1;
}

/* prepare process input data, set the data mem to input tensor */
get_input_fp32_data(image_file, input_data, img_h, img_w, mean, scale);

/* run graph */
double min_time = DBL_MAX;
double max_time = DBL_MIN;
double total_time = 0.;
for (int i = 0; i < repeat_count; i++)
{
double start = get_current_time();
if (run_graph(graph, 1) < 0)
{
fprintf(stderr, "Run graph failed\n");
return -1;
}
double end = get_current_time();
double cur = end - start;
total_time += cur;
if (min_time > cur)
min_time = cur;
if (max_time < cur)
max_time = cur;
}
printf("Repeat [%d] min %.3f ms, max %.3f ms, avg %.3f ms\n", repeat_count, min_time, max_time,
total_time / repeat_count);

/* get output tensor */
tensor_t output_tensor = get_graph_output_tensor(graph, 0, 0);

float* data = (float*)(get_tensor_buffer(output_tensor));
int data_size = get_tensor_buffer_size(output_tensor) / sizeof(float);

image img_out = imread(image_file);
for (int i = 0; i < data_size / 2; i++)
{
int x = (int)(data[2 * i] * (float)img_out.w / 144.f);
int y = (int)(data[2 * i + 1] * (float)img_out.h / 144.f);
draw_circle(img_out, x, y, 2, 0, 255, 0);
}

save_image(img_out, "landmark_out");

postrun_graph(graph);
destroy_graph(graph);
release_tengine();

return 0;
}
Loading
Loading