Skip to content

Commit

Permalink
Merge pull request #160 from PaddleCV-SIG/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
linhandev authored Jan 28, 2023
2 parents cc3701d + 5c6889e commit f1ad19c
Show file tree
Hide file tree
Showing 18 changed files with 671 additions and 514 deletions.
28 changes: 19 additions & 9 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build PaddleLabel package
name: Build & E2E Tests

on:
push:
Expand Down Expand Up @@ -93,14 +93,6 @@ jobs:
version: $(cat paddlelabel/version)
" >> $GITHUB_STEP_SUMMARY
- name: Bump version
id: bump_version
if: github.event_name == 'push'
run: |
python tool/bumpversion.py
git config --global user.email "[email protected]" && git config --global user.name "Action Bot"
git add paddlelabel/version; git commit -m "bump version"; git push
- name: Save built package
uses: actions/upload-artifact@v3
with:
Expand All @@ -112,3 +104,21 @@ jobs:
needs: build
# uses: PaddleCV-SIG/PaddleLabel/.github/workflows/cypress.yml@develop
uses: ./.github/workflows/cypress.yml

bump_version:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.11"]
needs: cypress_e2e_test
steps:
- name: Checkout backend code
uses: actions/checkout@v3

- name: Bump version
id: bump_version
if: github.event_name == 'push'
run: |
python tool/bumpversion.py
git config --global user.email "[email protected]" && git config --global user.name "Action Bot"
git add paddlelabel/version; git commit -m "bump version"; git push
40 changes: 33 additions & 7 deletions .github/workflows/cypress.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ jobs:
matrix:
node-version: ["19.x"]

# python-version: ["3.11", "3.10", "3.9", "3.8", "3.7"]
python-version: ["3.11", "3.10", "3.9", "3.8", "3.7"]
os: [ubuntu-latest, windows-latest, macos-latest]

python-version: ["3.11"]
# python-version: ["3.11"]
# os: [ubuntu-latest]

fail-fast: false
Expand All @@ -41,7 +41,10 @@ jobs:
cache-env: true
channels: conda-forge

- run: echo ${{ github.event_name }}

- name: Download built paddlelabel package
if: github.event_name == 'push'
uses: actions/download-artifact@v3
with:
name: PaddleLabel_built_package
Expand All @@ -54,21 +57,28 @@ jobs:
cd ~/测试路径/3rd_party/
curl -LO https://github.com/linhandev/static/releases/download/PaddleLabel%E7%9B%B8%E5%85%B3/paddlelabel_3rd_party_tests.zip
echo ----------------------------------
# ls
unzip -q paddlelabel_3rd_party_tests.zip
# pwd
# ls
} &
bgid=$!
echo $bgid
# download latest build
# curl -LO https://nightly.link/PaddleCV-SIG/PaddleLabel/workflows/build/develop/PaddleLabel_built_package.zip
# unzip PaddleLabel_built_package.zip
if [[ ${{ github.event_name }} != "push" ]]
then
echo "here"
curl -LO https://nightly.link/PaddleCV-SIG/PaddleLabel/workflows/build/develop/PaddleLabel_built_package.zip
pwd
ls
unzip PaddleLabel_built_package.zip
fi
pwd
ls
# install latest build
echo ========================================================
pip uninstall paddlelabel -y
pip uninstall paddlelabel -y
pip install paddlelabel-*-py3-none-any.whl
# wait for bg job
Expand Down Expand Up @@ -114,6 +124,22 @@ jobs:
# ls
echo "tests=$(python cypress/order_tests.py)" >> $GITHUB_OUTPUT
# - uses: Wandalen/wretry.action@master
# id: test
# with:
# action: cypress-io/github-action@v5
# with: |
# working-directory: ./cypress
# browser: chrome
# config: baseUrl=http://localhost:1111
# env: os=${{ matrix.os }}
# spec: ${{ steps.test_order.outputs.tests }}
# wait-on: "http://localhost:1111"
# wait-on-timeout: 120
# start-windows: yarn run test:win
# start: yarn run test:unix
# attempt_limit: 2

- name: Run tests
uses: cypress-io/github-action@v5
id: test
Expand Down
13 changes: 0 additions & 13 deletions .github/workflows/update_qr.yml

This file was deleted.

4 changes: 1 addition & 3 deletions doc/CN/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@

<b> 飞桨智能标注,让标注快人一步 </b>

<!-- TODO: can we make this 3.7+ -->

<p>
<img src="https://img.shields.io/badge/python-3.7+-blue.svg">
<img src="https://img.shields.io/badge/os-linux%2C%20windows%2C%20macos-blue.svg"/>
Expand All @@ -19,7 +17,7 @@
<!-- <a href="https://github.com/PaddleCV-SIG/doc/network/members"> <img src="https://img.shields.io/github/forks/PaddleCV-SIG/PaddleLabel?color=blue"/></a> -->
<a href="https://pypistats.org/packages/paddlelabel"><img src="https://img.shields.io/pypi/dm/paddlelabel?color=blue"/> </a>
<a href="https://pepy.tech/project/paddlelabel"><img src="https://static.pepy.tech/personalized-badge/paddlelabel?period=total&units=international_system&left_color=grey&right_color=blue&left_text=Total%20Downloads"/></a>
<a href="https://github.com/PaddleCV-SIG/PaddleLabel/actions/workflows/cypress.yml"><img src="https://github.com/PaddleCV-SIG/PaddleLabel/actions/workflows/cypress.yml/badge.svg"></a>
<a href="https://github.com/PaddleCV-SIG/PaddleLabel/actions/workflows/build.yml"><img src="https://github.com/PaddleCV-SIG/PaddleLabel/actions/workflows/build.yml/badge.svg"></a>
</p>
</div>

Expand Down
3 changes: 1 addition & 2 deletions paddlelabel/api/controller/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,11 @@
import flask
import tempfile

from paddlelabel.config import db
from .base import crud
from ..model import Data, Project, Task
from ..schema import DataSchema
from paddlelabel.api.util import abort
from paddlelabel.task.segmentation import draw_mask
from paddlelabel.task.instance_segmentation import draw_mask

get_all, get, post, put, delete = crud(Data, DataSchema)

Expand Down
77 changes: 42 additions & 35 deletions paddlelabel/api/controller/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import connexion

from paddlelabel.config import db
from paddlelabel.api.model import Project, Task, TaskCategory, Annotation, Label
from paddlelabel.api.model import Project, Task, TaskCategory, Annotation, Label, TaskCategory
from paddlelabel.api.schema import ProjectSchema
from paddlelabel.api.controller.base import crud
from paddlelabel.api.util import abort
Expand Down Expand Up @@ -199,6 +199,42 @@ def pre_put(project, body, se):
return project, body


# TODO: move to label controller
def create_label(project, label_name):
color = rand_hex_color([l.color for l in project.labels])
ids = [l.id for l in project.labels]
ids.append(0)
label = Label(
id=max(ids) + 1,
project_id=project.project_id,
name=label_name,
color=color,
)
project.labels.append(label)
db.session.commit()
return label


def post_delete(project, se):
warning_path = Path(project.data_dir) / "paddlelabel.warning"
if warning_path.exists():
warning_path.unlink()


get_all, get, post, put, delete = crud(
Project,
ProjectSchema,
triggers=[pre_add, post_add, pre_put, post_delete],
)


def to_easydata(project_id):
_, project = Project._exists(project_id)
task_category = TaskCategory._get(task_category_id=project.task_category_id)
handler = eval(task_category.handler)(project)
handler.to_easydata(project_id=project_id, **{k: connexion.request.json[k] for k in ["access_token", "dataset_id"]})


def split_dataset(project_id):
Project._exists(project_id)
split = connexion.request.json
Expand Down Expand Up @@ -239,22 +275,6 @@ def split_dataset(project_id):
}, 200


# TODO: move to label controller
def create_label(project, label_name):
color = rand_hex_color([l.color for l in project.labels])
ids = [l.id for l in project.labels]
ids.append(0)
label = Label(
id=max(ids) + 1,
project_id=project.project_id,
name=label_name,
color=color,
)
project.labels.append(label)
db.session.commit()
return label


def predict(project_id):
_, project = Project._exists(project_id)

Expand Down Expand Up @@ -305,21 +325,8 @@ def predict(project_id):
return "finished"


def to_easydata(project_id):
_, project = Project._exists(project_id)
task_category = TaskCategory._get(task_category_id=project.task_category_id)
handler = eval(task_category.handler)(project)
handler.to_easydata(project_id=project_id, **{k: connexion.request.json[k] for k in ["access_token", "dataset_id"]})


def post_delete(project, se):
warning_path = osp.join(project.data_dir, "paddlelabel.warning")
if osp.exists(warning_path):
os.remove(warning_path)


get_all, get, post, put, delete = crud(
Project,
ProjectSchema,
triggers=[pre_add, post_add, pre_put, post_delete],
)
def import_options(project_type):
all_catgs = TaskCategory._get(many=True)
assert project_type in [c.name for c in all_catgs], f"Project type specified {project_type} isn't supported"
selector = eval(f"paddlelabel.task.{project_type}.ProjectSubtypeSelector")()
print(selector.questions)
Loading

0 comments on commit f1ad19c

Please sign in to comment.