Skip to content

downsize a sample image #15

downsize a sample image

downsize a sample image #15

Workflow file for this run

# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
name: Python application
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.11
uses: actions/setup-python@v3
with:
python-version: "3.11"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install git+https://github.com/developer0hye/onepose.git
- name: Test Python
run: |
python -c "
import cv2
import onepose
import urllib
import numpy as np
import os
os.makedirs('ci_artifacts', exist_ok=True)
req = urllib.request.urlopen('https://raw.githubusercontent.com/developer0hye/onepose/main/onepose/assets/sample.png')
arr = np.asarray(bytearray(req.read()), dtype=np.uint8)
for model_name in onepose.list_models():
model = onepose.create_model(model_name)
img = cv2.imdecode(arr, cv2.IMREAD_COLOR) # 'Load it as it is'
keypoints = model(img)
num_keypoints = len(keypoints['points'])
pts = keypoints['points']
pts_confidence = keypoints['confidence']
for i in range(num_keypoints):
print(f'Point {i} {model.keypoint_info[i]} (x, y) : {pts[i]} confidence: {pts_confidence[i]}')
onepose.visualize_keypoints(img, keypoints, model.keypoint_info, model.skeleton_info)
cv2.imwrite(f'ci_artifacts/sample_{model_name}_output.png', img)
"
- name: upload artifacts
uses: actions/upload-artifact@v3
with:
name: outputs
path: ci_artifacts
retention-days: 1