Skip to content

Commit

Permalink
allow parent df to be None
Browse files Browse the repository at this point in the history
  • Loading branch information
rwood-97 committed Oct 10, 2024
1 parent 8eae31b commit 8db862b
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion mapreader/spot_text/deepsolo_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class DeepSoloRunner(RecRunner):
def __init__(
self,
patch_df: pd.DataFrame | gpd.GeoDataFrame | str | pathlib.Path,
parent_df: pd.DataFrame | gpd.GeoDataFrame | str | pathlib.Path = None,
parent_df: pd.DataFrame | gpd.GeoDataFrame | str | pathlib.Path | None = None,
cfg_file: str
| pathlib.Path = "./DeepSolo/configs/R_50/IC15/finetune_150k_tt_mlt_13_15_textocr.yaml",
weights_file: str
Expand Down
2 changes: 1 addition & 1 deletion mapreader/spot_text/dptext_detr_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class DPTextDETRRunner(Runner):
def __init__(
self,
patch_df: pd.DataFrame | gpd.GeoDataFrame | str | pathlib.Path,
parent_df: pd.DataFrame | gpd.GeoDataFrame | str | pathlib.Path = None,
parent_df: pd.DataFrame | gpd.GeoDataFrame | str | pathlib.Path | None = None,
cfg_file: str
| pathlib.Path = "./DPText-DETR/configs/DPText_DETR/ArT/R_50_poly.yaml",
weights_file: str | pathlib.Path = "./art_final.pth",
Expand Down
2 changes: 1 addition & 1 deletion mapreader/spot_text/maptext_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class MapTextRunner(RecRunner):
def __init__(
self,
patch_df: pd.DataFrame | gpd.GeoDataFrame | str | pathlib.Path,
parent_df: pd.DataFrame | gpd.GeoDataFrame | str | pathlib.Path = None,
parent_df: pd.DataFrame | gpd.GeoDataFrame | str | pathlib.Path | None = None,
cfg_file: str
| pathlib.Path = "./MapTextPipeline/configs/ViTAEv2_S/rumsey/final_rumsey.yaml",
weights_file: str | pathlib.Path = "./rumsey-finetune.pth",
Expand Down
5 changes: 4 additions & 1 deletion mapreader/spot_text/runner_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,10 @@ def _load_df(
"[ERROR] ``patch_df`` must be a path to a CSV/TSV/etc or geojson file, a pandas DataFrame or a geopandas GeoDataFrame."
)

if isinstance(parent_df, pd.DataFrame):
if parent_df is None:
self.parent_df = pd.DataFrame() # empty dataframe

elif isinstance(parent_df, pd.DataFrame):
self.parent_df = parent_df

elif isinstance(parent_df, (str, pathlib.Path)):
Expand Down

0 comments on commit 8db862b

Please sign in to comment.