Skip to content

Commit

Permalink
Merge pull request #39 from MortenTabaka/fix/Add-script-for-adding-pr…
Browse files Browse the repository at this point in the history
…oject-root-to-the-Python-path #patch

Fix/add script for adding project root to the python path
  • Loading branch information
MortenTabaka committed Oct 28, 2023
2 parents f6871e2 + 4253674 commit 78217ff
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
11 changes: 9 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,17 @@ also accessible on [PapersWithCode](https://paperswithcode.com/paper/landcover-a
**Please note that I am not the author or owner of this dataset, and I am using it under the terms of the license specified by the original author.
All credits for the dataset go to the original author and contributors.**

## Making Predictions on Custom Images
## Make predictions on custom images

After installing the necessary dependencies, execute the following command to run the prediction script:
After installing the necessary dependencies, execute the following scripts.

Add project root to the Python path:
```commandline
python3 models/scripts/add_project_root_to_the_python_path.py
```

Run prediction on images in `models/custom_data/input`:
```commandline
python3 models/scripts/run_prediction_on_folder.py
```
This script allows you to make predictions using the DeepLabv3+ model on a folder containing custom input images. You can use the following parameters to customize the prediction process:
Expand Down
14 changes: 14 additions & 0 deletions models/scripts/add_project_root_to_the_python_path.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import sys
import os


def get_project_root() -> str:
"""Returns the absolute path of the project root directory."""
current_dir = os.path.abspath(os.curdir)
while not os.path.isfile(os.path.join(current_dir, "README.md")):
current_dir = os.path.abspath(os.path.join(current_dir, os.pardir))
return current_dir


if __name__ == "__main__":
sys.path.insert(0, get_project_root())

0 comments on commit 78217ff

Please sign in to comment.