Skip to content

Commit

Permalink
Update graph ops parser & cleanup (#111)
Browse files Browse the repository at this point in the history
* cleanup command

* cleanup exporter

* cleanup networks

* cleanup predictor

* cleanup pipelines

* cleanup utils

* update graph ops parser using json

* update tests

* update init

* update requirements

* update changelog

* remove old reporter

* move graph ops init

* move detr collater

* separate lint and tests for CI

* remove unused external module

* restore yolov3

* Update lint.yml
  • Loading branch information
alifahrri authored Apr 16, 2021
1 parent 9b959d8 commit cfbaaeb
Show file tree
Hide file tree
Showing 140 changed files with 221 additions and 16,411 deletions.
Original file line number Diff line number Diff line change
@@ -1,20 +1,14 @@
name: Test Only
name: Lint

# manual run, test only without linter
# on:
# workflow_dispatch:
# inputs:
# logLevel:
# description: 'Log level'
# required: true
# default: 'warning'
# tags:
# description: 'Test scenario tags'
# temporary use this, manual run button doesn't appear at actions tab
on: [pull_request]
on:
push:
branches: [master]
pull_request:
release:
types: [published, edited]

jobs:
tests:
lint:
runs-on: ubuntu-20.04
strategy:
matrix:
Expand All @@ -31,6 +25,9 @@ jobs:
python -m pip install --upgrade pip
python -m pip install flake8 pytest pytest-cov
pip install "./src/development[test]" "./src/runtime[all]"
- name: Test with pytest
- name: Lint with flake8
run: |
pytest -v tests
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82,F5 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
16 changes: 5 additions & 11 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
name: Lint and Test
name: Test

on:
push:
branches: [master]
pull_request:
release:
types: [published, edited]
branches: [master]
pull_request:
release:
types: [published, edited]

jobs:
tests:
Expand All @@ -25,12 +25,6 @@ jobs:
python -m pip install --upgrade pip
python -m pip install flake8 pytest pytest-cov
pip install "./src/development[test]" "./src/runtime[all]"
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82,F5 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
pytest -v tests
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- deprecating 'config.seed', and move to 'config.trainer.seed'
- deprecating `stage` argument in `create_model`
- all defined backbones use backbone base class
- removed various old features affected by API redesign: `cli`, `predictor`, `pipelines`

### Fixed

Expand Down
24 changes: 0 additions & 24 deletions examples/detr/module/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -478,22 +478,6 @@ def __getitem__(self, idx):
return img, target


def convert_coco_poly_to_mask(segmentations, height, width):
masks = []
for polygons in segmentations:
rles = coco_mask.frPyObjects(polygons, height, width)
mask = coco_mask.decode(rles)
if len(mask.shape) < 3:
mask = mask[..., None]
mask = torch.as_tensor(mask, dtype=torch.uint8)
mask = mask.any(dim=2)
masks.append(mask)
if masks:
masks = torch.stack(masks, dim=0)
else:
masks = torch.zeros((0, height, width), dtype=torch.uint8)
return masks


class ConvertCocoPolysToMask(object):
def __init__(self, return_masks=False):
Expand All @@ -519,10 +503,6 @@ def __call__(self, image, target):
classes = [obj["category_id"] for obj in anno]
classes = torch.tensor(classes, dtype=torch.int64)

if self.return_masks:
segmentations = [obj["segmentation"] for obj in anno]
masks = convert_coco_poly_to_mask(segmentations, h, w)

keypoints = None
if anno and "keypoints" in anno[0]:
keypoints = [obj["keypoints"] for obj in anno]
Expand All @@ -534,16 +514,12 @@ def __call__(self, image, target):
keep = (boxes[:, 3] > boxes[:, 1]) & (boxes[:, 2] > boxes[:, 0])
boxes = boxes[keep]
classes = classes[keep]
if self.return_masks:
masks = masks[keep]
if keypoints is not None:
keypoints = keypoints[keep]

target = {}
target["boxes"] = boxes
target["labels"] = classes
if self.return_masks:
target["masks"] = masks
target["image_id"] = image_id
if keypoints is not None:
target["keypoints"] = keypoints
Expand Down
3 changes: 0 additions & 3 deletions external/.gitignore

This file was deleted.

Empty file removed external/__init__.py
Empty file.
19 changes: 0 additions & 19 deletions external/datasets/README.md

This file was deleted.

1 change: 0 additions & 1 deletion src/development/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ matplotlib
enlighten
future
Pillow
enforce
onnx==1.6.0
mypy
pyyaml
Expand Down
3 changes: 1 addition & 2 deletions src/development/vortex/development/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from .version import __version__
from .utils import create_model

# expose registry to top-level for shorthand
from .exporter.utils.onnx.graph_ops import GRAPH_OPS as ONNX_GRAPH_OPS
from .exporter.utils.onnx import GRAPH_OPS as ONNX_GRAPH_OPS
from .networks.models import MODELS
Empty file.
79 changes: 0 additions & 79 deletions src/development/vortex/development/command/export.py

This file was deleted.

112 changes: 0 additions & 112 deletions src/development/vortex/development/command/hypopt.py

This file was deleted.

Loading

0 comments on commit cfbaaeb

Please sign in to comment.