Skip to content

Commit b0153bd

Browse files
committed
Include CH's review
1 parent 134e81c commit b0153bd

File tree

3 files changed

+14
-13
lines changed

3 files changed

+14
-13
lines changed

examples/road-surface-classification/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ $ stdl-objdet make_detections config_rs.yaml
3030
$ stdl-objdet assess_detections config_rs.yaml
3131
```
3232

33-
The docker container is existed and the permission restored with.
33+
The docker container is exited and permissions restored with:
3434

3535
```bash
3636
$ exit
37-
$ sudo chmod -r a+w examples
37+
$ sudo chmod -R a+w examples
3838
```
3939

4040
This example is made up from a subset of the data used in the proj-roadsurf project. For more information about this project, you can consult [the associated repository](https://github.com/swiss-territorial-data-lab/proj-roadsurf) and [its full documentation](https://tech.stdl.ch/PROJ-ROADSURF/). <br>

helpers/misc.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,14 @@ def geohash(row):
227227

228228

229229
def get_number_of_classes(coco_files_dict):
230+
"""Read the number of classes from the tileset COCO file.
231+
232+
Args:
233+
coco_files_dict (dict): COCO file of the tileset
234+
235+
Returns:
236+
num_classes (int): number of classes in the dataset
237+
"""
230238

231239
file_content = open(next(iter(coco_files_dict.values())))
232240
coco_json = json.load(file_content)

scripts/generate_tilesets.py

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -150,10 +150,7 @@ def _id_to_xyz(row):
150150
Convert 'id' string to list of ints for x, y, z and t if eligeable
151151
"""
152152

153-
try:
154-
assert (row['id'].startswith('(')) & (row['id'].endswith(')')), 'The id should be surrounded by parenthesis.'
155-
except AssertionError as e:
156-
raise AssertionError(e)
153+
assert (row['id'].startswith('(')) & (row['id'].endswith(')')), 'The id should be surrounded by parenthesis.'
157154

158155
if 'year_tile' in row.keys():
159156
try:
@@ -281,7 +278,7 @@ def main(cfg_file_path):
281278
WORKING_DIR = cfg['working_directory']
282279
OUTPUT_DIR = cfg['output_folder']
283280

284-
# Get info for the download of tiles
281+
# Get tile download information
285282
IM_SOURCE_TYPE = cfg['datasets']['image_source']['type'].upper()
286283
IM_SOURCE_LOCATION = cfg['datasets']['image_source']['location']
287284
if IM_SOURCE_TYPE != 'XYZ':
@@ -294,7 +291,7 @@ def main(cfg_file_path):
294291

295292
AOI_TILES = cfg['datasets']['aoi_tiles']
296293

297-
# Get info for labels if available
294+
# Get label info if available
298295
GT_LABELS = cfg['datasets']['ground_truth_labels'] if 'ground_truth_labels' in cfg['datasets'].keys() else None
299296
OTH_LABELS = cfg['datasets']['other_labels'] if 'other_labels' in cfg['datasets'].keys() else None
300297
FP_LABELS = cfg['datasets']['FP_labels'] if 'FP_labels' in cfg['datasets'].keys() else None
@@ -652,11 +649,7 @@ def main(cfg_file_path):
652649
empty_tiles_gdf = aoi_tiles_gdf[aoi_tiles_gdf.id.astype(str).isin(id_list_ept_tiles)].copy()
653650

654651
if DEBUG_MODE:
655-
try:
656-
assert(len(empty_tiles_gdf != 0))
657-
except AssertionError:
658-
logger.error("No emtpy tile was selected for the debug mode. Increase the number of sampled tiles in debug mode")
659-
exit(1)
652+
assert(len(empty_tiles_gdf != 0)), "No empty tiles could be added. Increase the number of tiles sampled in debug mode"
660653

661654
oth_tiles_gdf = oth_tiles_gdf[~oth_tiles_gdf.id.astype(str).isin(empty_tiles_gdf.id.astype(str))].copy()
662655
oth_tiles_gdf['dataset'] = 'oth'

0 commit comments

Comments
 (0)