Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
72dc235
Added file including strategies for reader
AyleenSohaib Aug 12, 2023
b3fad7f
changes to for loops and class constructors
AyleenSohaib Aug 12, 2023
e062bf9
changes to interface name, get function and constructor
AyleenSohaib Aug 13, 2023
f043497
added strategies using rasterio to read images
AyleenSohaib Aug 15, 2023
0384f8a
removed mask strategies and added to constructor
AyleenSohaib Aug 15, 2023
ba9339b
fixed constructor and set image_resample to default
AyleenSohaib Aug 15, 2023
ff018b0
added resizing to hyperspectral strategy
AyleenSohaib Aug 17, 2023
cd9cd37
added tests for strategies - they do not yet pass
AyleenSohaib Aug 17, 2023
3e05fef
updated test to pass, updates variable assigment in strategy construc…
Sajtospoga01 Aug 17, 2023
583fd50
added variable to initialiser
AyleenSohaib Aug 24, 2023
c5b3231
updated 3 tests to pass, added rasterio but incomplete
AyleenSohaib Aug 24, 2023
8437d47
Added file including strategies for reader
AyleenSohaib Aug 12, 2023
b216ee3
changes to for loops and class constructors
AyleenSohaib Aug 12, 2023
e3c626a
changes to interface name, get function and constructor
AyleenSohaib Aug 13, 2023
7f6798b
added strategies using rasterio to read images
AyleenSohaib Aug 15, 2023
26d4576
removed mask strategies and added to constructor
AyleenSohaib Aug 15, 2023
e3b0fbd
fixed constructor and set image_resample to default
AyleenSohaib Aug 15, 2023
04483c0
added resizing to hyperspectral strategy
AyleenSohaib Aug 17, 2023
b48a4e6
added tests for strategies - they do not yet pass
AyleenSohaib Aug 17, 2023
11e7aac
updated test to pass, updates variable assigment in strategy construc…
Sajtospoga01 Aug 17, 2023
a416419
added variable to initialiser
AyleenSohaib Aug 24, 2023
ef1ffd0
updated 3 tests to pass, added rasterio but incomplete
AyleenSohaib Aug 24, 2023
13e60d2
updated the test for hyperspectral to pass
AyleenSohaib Aug 24, 2023
f67f291
Merge branch 'dev_data_reader_heads' of https://github.com/guorbit/ut…
AyleenSohaib Aug 24, 2023
e99b869
adds dependency injection to the rasterio strategy for better testabi…
Sajtospoga01 Aug 24, 2023
047789a
adds rasterio strategy test, with functional mock class.
Sajtospoga01 Aug 24, 2023
0f87361
updates strategies to store images in batches for proper value return
Sajtospoga01 Aug 24, 2023
8308288
migrate mock class to a mock_classes.py package for better sectionabi…
Sajtospoga01 Aug 24, 2023
9836476
remove mock class dependency, for better felxibility, adds marker fla…
Sajtospoga01 Aug 24, 2023
4e4eba6
updated the read_batch function to use strategies
AyleenSohaib Aug 24, 2023
f45d227
updates tests for flowgenerator experimental, updates flowreader resh…
Sajtospoga01 Aug 25, 2023
dca7bb0
update development pipeline to filter staging for now
Sajtospoga01 Aug 25, 2023
692bb89
remove unnecessary files
Sajtospoga01 Aug 25, 2023
a83bb42
update code cov not to include staging
Sajtospoga01 Aug 25, 2023
cfcef39
adds development markers to image_preprocessor_test, and test_flowreader
Sajtospoga01 Aug 25, 2023
522d54f
updates flowgenerator tests to cover additional cases, removes unnece…
Sajtospoga01 Aug 25, 2023
4bf77e9
update protocol of strategies
Sajtospoga01 Aug 25, 2023
dfd0f1f
added shuffle method and getter for image_size
AyleenSohaib Aug 25, 2023
5ea374a
update strategies with shuffle and get image size method, updates flo…
Sajtospoga01 Aug 25, 2023
51900d8
added more tests, changed variable name image_resize to image_size Hy…
AyleenSohaib Aug 25, 2023
5798918
adds ability to rgbstrategy readbatch to determine if it is reading g…
Sajtospoga01 Aug 25, 2023
ea85f3f
fixes possible bug in read_batch
Sajtospoga01 Aug 25, 2023
1dc5a8c
fixes bug where there are too many indices indexed
Sajtospoga01 Aug 25, 2023
a2f5ac9
add a print for testing
Sajtospoga01 Aug 25, 2023
f366fb7
removes unnecessary comma
Sajtospoga01 Aug 25, 2023
4fa965d
adds debugging print statements
Sajtospoga01 Aug 25, 2023
f6de5cf
adds more debug info
Sajtospoga01 Aug 25, 2023
01e9e81
fixes possible problem with dataset indexing
Sajtospoga01 Aug 25, 2023
1f010ba
removes print statements for debugging
Sajtospoga01 Aug 25, 2023
cab20a8
reads debug logs
Sajtospoga01 Aug 25, 2023
b74b2cc
removes print statements
Sajtospoga01 Aug 26, 2023
a3c8070
push fix to indexing error
Sajtospoga01 Aug 26, 2023
a88497e
fixing linting issues, removing unused imports
Sajtospoga01 Aug 26, 2023
841ee0f
added partial_dataset and adjusted_batch_size to read_batch - to allo…
AyleenSohaib Aug 26, 2023
8ae3d0e
adds dataset size to flowgenerator_exp, adds multi threaded version o…
Sajtospoga01 Aug 26, 2023
97d2913
update preprocessing to use adjusted_batch
Sajtospoga01 Aug 26, 2023
d2c8ecd
test if works with no adjustment
Sajtospoga01 Aug 26, 2023
e20f19c
adds printstatements for debugging
Sajtospoga01 Aug 26, 2023
e06f47f
adds more debugging statements
Sajtospoga01 Aug 26, 2023
f2a9cef
adds even more debugging print
Sajtospoga01 Aug 26, 2023
095cfe9
possibly fixes error with incorrect dataset size calculation in initi…
Sajtospoga01 Aug 26, 2023
7ef8fc9
more print
Sajtospoga01 Aug 26, 2023
603bc03
adds possible fix for incorrect dataset size calculation
Sajtospoga01 Aug 26, 2023
f23bc4d
pil image loader strategy multi threaded version
Sajtospoga01 Aug 26, 2023
a777cc0
removes debugging print statements from flowgenerator, optimizes mult…
Sajtospoga01 Aug 26, 2023
14ad5a1
renames previous hyperspectralstrategy to rasterstrategy, adds new hy…
Sajtospoga01 Aug 27, 2023
a14348c
adds scipy to the dependency list
Sajtospoga01 Aug 27, 2023
6551328
update pipeline to use toml file for dependency install
Sajtospoga01 Aug 27, 2023
04f976b
update all stages to install dependencies from toml config
Sajtospoga01 Aug 27, 2023
58d6d2c
adds experimental hsi strategy based on cv2
Sajtospoga01 Aug 27, 2023
8729166
removes scipy and SPy
Sajtospoga01 Aug 27, 2023
8d055b2
update get band function to use opencv in HSI strategy, updates openc…
Sajtospoga01 Aug 27, 2023
118371c
adds multi threaded hsi strategy
Sajtospoga01 Aug 27, 2023
0d9c97f
fixed linting problems in strategies file
Sajtospoga01 Aug 27, 2023
2defb3e
updates pipelines to rely on pyproject.toml to install packages. Upda…
Sajtospoga01 Aug 27, 2023
f5e312c
adds documentation to fixtures
Sajtospoga01 Aug 27, 2023
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
10 changes: 5 additions & 5 deletions .github/workflows/development.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install pre-commit
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
pip install .[dev]

test:
needs: dependency-install
Expand All @@ -42,10 +42,10 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install pytest pytest-mock
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
pip install .[dev]
- name: Test with pytest
run: |
python -m pytest
python -m pytest -v -m "development"

devops:
needs: test
Expand All @@ -62,7 +62,7 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install pre-commit
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
pip install .[dev]
- name: Lint with pylint
run: |
pip install pylint
Expand All @@ -71,7 +71,7 @@ jobs:
run: |
mkdir -p ./coverage
pip install pytest-cov pytest-mock
python -m pytest --cov --cov-report=xml:./coverage/coverage.xml
python -m pytest -m "not staging" --cov --cov-report=xml:./coverage/coverage.xml

- name: Upload coverage
uses: codecov/codecov-action@v3
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,13 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
pip install .[dev]
pip install -U sphinx
pip install furo

- name: Build documentation
run: |
cd docs


sphinx-apidoc -e -M --force -o . ../utilities/
make html
- name: Upload build data
Expand Down
16 changes: 11 additions & 5 deletions .github/workflows/master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install pre-commit
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
pip install .[dev]

test:
needs: dependency-install
Expand All @@ -42,10 +42,16 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install pytest pytest-mock
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Test with pytest
pip install .[dev]
- name: Test with pytest development
run: |
python -m pytest
python -m pytest -v -m "development"
- name: Test with pytest staging
run: |
python -m pytest -v -m "staging"
- name: Test with pytest production
run: |
python -m pytest -v -m "production"

devops:
needs: test
Expand All @@ -62,7 +68,7 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install pre-commit
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
pip install .[dev]
- name: Lint with pylint
run: |
pip install pylint
Expand Down
13 changes: 8 additions & 5 deletions .github/workflows/staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install pre-commit
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
pip install .[dev]

test:
needs: dependency-install
Expand All @@ -42,10 +42,13 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install pytest pytest-mock
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Test with pytest
pip install .[dev]
- name: Test with pytest development
run: |
python -m pytest
python -m pytest -v -m "development"
- name: Test with pytest staging
run: |
python -m pytest -v -m "staging"

devops:
needs: test
Expand All @@ -62,7 +65,7 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install pre-commit
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
pip install .[dev]
- name: Lint with pylint
run: |
pip install pylint
Expand Down
9 changes: 9 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,20 @@ dependencies = [
"Pillow >= 9.4.0",
"tensorflow >= 2.10",
"toml >= 0.10.2",
"tqdm >= 4.64.1",
"pandas >= 1.5.1",
"opencv-python-headless >= 4.8.0.76"
]

[tool.setuptools]
packages = ["utilities"]

[tool.pytest.ini_options]
markers = [
"staging: Mark a test as part of the staging environment",
"production: Mark a test as part of the production environment",
"development: Mark a test as part of the development environment",
]

[project.optional-dependencies]
dev = [
Expand Down
7 changes: 0 additions & 7 deletions requirements.txt

This file was deleted.

13 changes: 7 additions & 6 deletions tests/segmentation_utils_tests.py/flow_reader_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ def flow_from_directory_mock(*args, **kwargs):


# tests
@pytest.mark.development
def test_makes_flow_generator() -> None:
patch = MonkeyPatch()
# mock an imagedatagenerator from keras
Expand All @@ -48,7 +49,7 @@ def test_makes_flow_generator() -> None:
# create a flow generator
FlowGenerator(**generator_args)


@pytest.mark.development
def test_makes_flow_generator_with_queue() -> None:
patch = MonkeyPatch()
# mock an imagedatagenerator from keras
Expand Down Expand Up @@ -78,7 +79,7 @@ def test_makes_flow_generator_with_queue() -> None:
generator = FlowGenerator(**new_generator_args)
generator.set_preprocessing_pipeline(image_queue, mask_queue)


@pytest.mark.development
def test_makes_flow_generator_wrong_shape() -> None:
try:
patch = MonkeyPatch()
Expand All @@ -98,7 +99,7 @@ def test_makes_flow_generator_wrong_shape() -> None:
except ValueError:
assert True


@pytest.mark.development
def test_makes_flow_generator_wrong_dimension() -> None:
try:
patch = MonkeyPatch()
Expand All @@ -118,7 +119,7 @@ def test_makes_flow_generator_wrong_dimension() -> None:
except ValueError:
assert True


@pytest.mark.development
def test_flow_generator_with_preprocess() -> None:
patch = MonkeyPatch()
# mock an imagedatagenerator from keras
Expand All @@ -141,7 +142,7 @@ def test_flow_generator_with_preprocess() -> None:
patch.undo()
patch.undo()


@pytest.mark.development
def test_get_dataset_size() -> None:
patch = MonkeyPatch()
patch.setattr(os, "listdir", lambda x: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10])
Expand All @@ -166,7 +167,7 @@ def test_get_dataset_size() -> None:
patch.undo()
patch.undo()


@pytest.mark.development
def test_get_generator() -> None:
patch = MonkeyPatch()

Expand Down
10 changes: 5 additions & 5 deletions tests/segmentation_utils_tests.py/image_preprocessor_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def test_image_onehot_encoder_column() -> None:
)
assert np.array_equal(one_hot_image, onehot_test)


@pytest.mark.development
def test_image_onehot_encoder_squarematrix() -> None:
# predifining input variables
n_classes = 2
Expand All @@ -58,7 +58,7 @@ def test_image_onehot_encoder_squarematrix() -> None:
)
assert np.array_equal(one_hot_image, onehot_test)


@pytest.mark.development
def test_image_augmentation_pipeline_squarematrix() -> None:
# predifining input variables
image = np.zeros((512, 512, 3))
Expand Down Expand Up @@ -89,7 +89,7 @@ def test_image_augmentation_pipeline_squarematrix() -> None:
assert image_new.shape == (512, 512, 3)
assert mask_new.shape == (256, 256, 1)


@pytest.mark.development
def test_processing_queue() -> None:
# creating dummy queues

Expand All @@ -102,7 +102,7 @@ def test_processing_queue() -> None:

assert image_queue.queue[0].kwargs["seed"] == new_seed


@pytest.mark.development
def test_generate_default_queue() -> None:
# creating default queues
image_queue, mask_queue = ImagePreprocessor.generate_default_queue()
Expand All @@ -111,7 +111,7 @@ def test_generate_default_queue() -> None:
assert image_queue.get_queue_length() == 5
assert mask_queue.get_queue_length() == 2


@pytest.mark.development
def test_flatten() -> None:
image = np.zeros((512, 512, 3))
image = tf.convert_to_tensor(image)
Expand Down
Loading