Skip to content

Commit

Permalink
Merged main into cmaas_utils
Browse files Browse the repository at this point in the history
  • Loading branch information
abodeuis committed Jun 6, 2024
2 parents 703d12b + 3bb8baf commit c69f1e5
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 5 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python

name: Pytest

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:
build:

runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
python-version: ["3.10.14", "3.11.7"]

steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install pytest pytest-cov
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Test with pytest
run: |
pytest tests
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,4 @@ Example of a validation image from a UIUC model run on AR_StJoe_Mbs_poly
Flag to enable the saving of debugging feedback images.

## Authors and acknowledgment
This repo was created by and is maintained by the UIUC team.
This repo was created by and is maintained by the amazing UIUC team.
14 changes: 10 additions & 4 deletions src/grading.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,15 @@ def grade_poly_raster(pred_image, true_image, feedback_image=None):
result['IoU Score'] = true_positive / np.count_nonzero(union)

if feedback_image is not None:
feedback_image[(true_image>=1).all(-1)] = MISS_COLOR
feedback_image[(pred_image>=1).all(-1)] = FAIL_COLOR
feedback_image[(intersection==1).all(-1)] = CORRECT_COLOR
feedback_image[0][(true_image>=1)[0]] = MISS_COLOR[0]
feedback_image[1][(true_image>=1)[0]] = MISS_COLOR[1]
feedback_image[2][(true_image>=1)[0]] = MISS_COLOR[2]
feedback_image[0][(pred_image>=1)[0]] = FAIL_COLOR[0]
feedback_image[1][(pred_image>=1)[0]] = FAIL_COLOR[1]
feedback_image[2][(pred_image>=1)[0]] = FAIL_COLOR[2]
feedback_image[0][(intersection==1)[0]] = CORRECT_COLOR[0]
feedback_image[1][(intersection==1)[0]] = CORRECT_COLOR[1]
feedback_image[2][(intersection==1)[0]] = CORRECT_COLOR[2]

return result, feedback_image

Expand Down Expand Up @@ -301,4 +307,4 @@ def detect_difficult_pixels(map_image, true_image, feature_bounding_box, color_r
# the outside pixels will be deemed easy!
hard_pixel_mask=pred_by_color

return hard_pixel_mask
return hard_pixel_mask

0 comments on commit c69f1e5

Please sign in to comment.