Skip to content

Commit

Permalink
Update GeoInference parameters and output formats
Browse files Browse the repository at this point in the history
  • Loading branch information
valhassan committed Jul 12, 2024
1 parent ef1be3d commit 71bc6e9
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ python geo_inference.py -i <image> -m <model> -wd <work_dir> -bs <batch_size> -v
- `-wd`, `--work_dir`: Working Directory
- `-bs`, `--batch_size`: The Batch Size
- `-v`, `--vec`: Vector Conversion
- `-y`, `--yolo`: Yolo Conversion
- `-c`, `--coco`: Coco Conversion
- `-d`, `--device`: CPU or GPU Device
- `-id`, `--gpu_id`: GPU ID, Default = 0

Expand All @@ -54,16 +56,17 @@ geo_inference = GeoInference(
model="/path/to/segformer_B5.pt",
work_dir="/path/to/work/dir",
batch_size=4,
mask_to_vec=True,
mask_to_vec=False,
vec_to_yolo=False,
vec_to_coco=False,
device="gpu",
gpu_id=0
)

# Perform feature extraction on a TIFF image
image_path = "/path/to/image.tif"
patch_size = 512
stride_size = 256
geo_inference(image_path, patch_size, stride_size)
geo_inference(tiff_image = image_path, patch_size = patch_size,)
```

## Parameters
Expand All @@ -73,7 +76,9 @@ The `GeoInference` class takes the following parameters:
- `model`: The path or URL to the model file (.pt for PyTorch models) to use for feature extraction.
- `work_dir`: The path to the working directory. Default is `"~/.cache"`.
- `batch_size`: The batch size to use for feature extraction. Default is `4`.
- `mask_to_vec`: If set to `"True"`, vector files will be created. Default is `"False"`
- `mask_to_vec`: If set to `"True"`, vector data will be created from mask. Default is `"False"`
- `vec_to_yolo`: If set to `"True"`, vector data will be converted to YOLO format. Default is `"False"`
- `vec_to_coco`: If set to `"True"`, vector data be converted to COCO format. Default is `"False"`
- `device`: The device to use for feature extraction. Can be `"cpu"` or `"gpu"`. Default is `"gpu"`.
- `gpu_id`: The ID of the GPU to use for feature extraction. Default is `0`.

Expand All @@ -83,7 +88,8 @@ The `GeoInference` class outputs the following files:

- `mask.tif`: The output mask file in TIFF format.
- `polygons.geojson`: The output polygon file in GeoJSON format. This file is only generated if the `mask_to_vec` parameter is set to `True`.
- `yolo.csv`: The output YOLO file in CSV format. This file is only generated if the `mask_to_vec` parameter is set to `True`.
- `yolo.csv`: The output YOLO file in CSV format. This file is only generated if the `mask_to_vec`, `vec_to_yolo` parameters are set to `True`.
- `coco.json`: The output COCO file in JSON format. This file is only generated if the `mask_to_vec`, `vec_to_coco` parameters are set to `True`.

Each file contains the extracted features from the input geospatial imagery.

Expand Down

0 comments on commit 71bc6e9

Please sign in to comment.