Skip to content

Commit

Permalink
Merge pull request #47 from iamtekson/dev
Browse files Browse the repository at this point in the history
advance deep learning related docs update
  • Loading branch information
iamtekson authored Oct 8, 2023
2 parents 55e4dac + a0789b3 commit 7b0a37e
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions docs/source/pages/advance.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ The main motivation of this library is to create the easy pipeline to handle the
The library is able to create the labels or masks from the vector data. The vector data can be in any format such as geojson, shapefile, etc. The library is able to create the masks of the vector data in the raster format. The below is the example of creating the mask from the shapefile,

```python
from geotile.geotile import GeoTile
from geotile import GeoTile
gt = GeoTile('/path/to/raster/file.tif')
gt.rasterization('/path/to/vector/file.shp', output_folder='/path/to/output/file.tif')
```

If you didn't pass the `value_col` parameter, the library will create the mask of the vector data with binary values, i.e. 0 and 1. If you want to create the mask with the specific values, you can pass the `value_col` parameter as below,

```python
from geotile.geotile import GeoTile
from geotile import GeoTile
gt = GeoTile('/path/to/raster/file.tif')
gt.rasterization('/path/to/vector/file.shp', out_path='/path/to/output/file.tif', value_col='class')
```
Expand All @@ -29,7 +29,7 @@ Using the rasterization function, you don't need to worry about the metadata and
The library is able to create the tiles from both images and masks. The below is the example of creating the tiles from the image,

```python
from geotile.geotile import GeoTile
from geotile import GeoTile

# create the tiles of the raster imagery
gt_img = GeoTile('/path/to/raster/file.tif')
Expand All @@ -44,7 +44,7 @@ If you don't want to save the tiles, you have to pass the `save_tiles=False` par
The below is the example of creating the tiles without saving them,

```python
from geotile.geotile import GeoTile
from geotile import GeoTile

# create the tiles of the raster imagery
gt_img = GeoTile('/path/to/raster/file.tif')
Expand All @@ -61,15 +61,15 @@ If you want to preprocess (such as normalization, removing nan, etc.) the tiles

```python
# generate the tiles
gt.generate_tiles(save_tiles=False)
gt.normalize_tiles()
gt.convert_nan_to_zero()
gt_img.generate_tiles(save_tiles=False)
gt_img.convert_nan_to_zero()
gt_img.normalize_tiles()

# save the tiles in numpy format; shape of the array will be (num_tiles, tile_x, tile_y, bands)
gt.save_numpy(output_folder=r'/path/to/output/folder')
gt_img.save_numpy(output_folder=r'/path/to/output/folder')

# save the tiles in tif format
gt.save_tiles(output_folder=r'/path/to/output/folder', prefix='tile_')
gt_img.save_tiles(output_folder=r'/path/to/output/folder', prefix='tile_')
```

If your main goal is to train the deep learning model, you can only save the tiles as a numpy array and ignore saving tiles as a tif file. The numpy array will be more efficient and faster to load in the deep learning model.
Expand All @@ -79,7 +79,7 @@ If your main goal is to train the deep learning model, you can only save the til
You can now use your deep learning model to predict the tiles. The below is the example of predicting the tiles,

```python
from geotile.geotile import GeoTile
from geotile import GeoTile
from geotile import mosaic

# create the tiles of the raster imagery
Expand Down

0 comments on commit 7b0a37e

Please sign in to comment.