Skip to content

Commit

Permalink
add text spotting and update gitignore
Browse files Browse the repository at this point in the history
  • Loading branch information
rwood-97 committed Nov 12, 2024
1 parent 6796939 commit 5253539
Show file tree
Hide file tree
Showing 5 changed files with 1,038 additions and 70 deletions.
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
# maps and patches
worked_examples/geospatial/maps/
worked_examples/geospatial/patches_*_*/

# classification one inch
worked_examples/geospatial/*classification_one_inch_maps/*
!worked_examples/geospatial/*classification_one_inch_maps/Pipeline.ipynb
!worked_examples/geospatial/*classification_one_inch_maps/annotations_one_inch/

# text spotting one inch
worked_examples/geospatial/text_spotting_one_inch_maps/*/*
!worked_examples/geospatial/text_spotting_one_inch_maps/*/*/Pipeline.ipynb
!worked_examples/geospatial/text_spotting_one_inch_maps/*/Pipeline.ipynb

# classification mnist
worked_examples/non-geospatial/classification_mnist/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -109,7 +109,7 @@
"outputs": [],
"source": [
"my_ts.get_grid_bb(zoom_level=14)\n",
"my_ts.download_map_sheets_by_queries(force=True)"
"my_ts.download_map_sheets_by_queries(path_save=\"../maps\", force=True)"
]
},
{
Expand All @@ -132,7 +132,7 @@
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": 9,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -145,7 +145,7 @@
"metadata": {},
"outputs": [],
"source": [
"my_files = loader(\"./maps/*png\")"
"my_files = loader(\"../maps/*png\")"
]
},
{
Expand Down Expand Up @@ -173,7 +173,7 @@
"metadata": {},
"outputs": [],
"source": [
"my_files.add_metadata(\"./maps/metadata.csv\")"
"my_files.add_metadata(\"../maps/metadata.csv\")"
]
},
{
Expand All @@ -188,7 +188,7 @@
},
{
"cell_type": "code",
"execution_count": 16,
"execution_count": 15,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -211,7 +211,7 @@
},
"outputs": [],
"source": [
"my_files.patchify_all(patch_size=100) # in pixels"
"my_files.patchify_all(patch_size=100, path_save=\"../patches_100_pixel\") # in pixels"
]
},
{
Expand Down Expand Up @@ -343,7 +343,7 @@
},
{
"cell_type": "code",
"execution_count": 27,
"execution_count": 26,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -359,9 +359,9 @@
"outputs": [],
"source": [
"annotator = Annotator(\n",
" patch_paths=\"./patches_100_pixel/*png\",\n",
" parent_paths=\"./maps/*png\",\n",
" metadata_path=\"./maps/metadata.csv\",\n",
" patch_paths=\"../patches_100_pixel/*png\",\n",
" parent_paths=\"../maps/*png\",\n",
" metadata_path=\"../maps/metadata.csv\",\n",
" annotations_dir=\"./annotations_one_inch\",\n",
" labels=[\"no\", \"railspace\"],\n",
" username=\"rw\",\n",
Expand Down Expand Up @@ -399,7 +399,7 @@
},
{
"cell_type": "code",
"execution_count": 30,
"execution_count": 29,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -416,7 +416,7 @@
"source": [
"annotated_images = AnnotationsLoader()\n",
"\n",
"annotated_images.load(\"./annotations_one_inch/rail_space_#rw#.csv\", images_dir=\"./patches_100_pixel\")"
"annotated_images.load(\"./annotations_one_inch/rail_space_#rw#.csv\", images_dir=\"../patches_100_pixel\")"
]
},
{
Expand Down Expand Up @@ -517,7 +517,7 @@
},
{
"cell_type": "code",
"execution_count": 39,
"execution_count": 38,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -532,7 +532,7 @@
},
"outputs": [],
"source": [
"my_classifier = ClassifierContainer(model =\"resnet18\",\n",
"my_classifier = ClassifierContainer(model=\"resnet18\",\n",
" labels_map={0: 'No', 1: 'railspace'},\n",
" dataloaders=dataloaders,\n",
" )"
Expand Down Expand Up @@ -577,7 +577,7 @@
},
{
"cell_type": "code",
"execution_count": 44,
"execution_count": 43,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -588,7 +588,7 @@
},
{
"cell_type": "code",
"execution_count": 45,
"execution_count": 44,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -597,7 +597,7 @@
},
{
"cell_type": "code",
"execution_count": 46,
"execution_count": 45,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -693,7 +693,7 @@
},
{
"cell_type": "code",
"execution_count": 52,
"execution_count": 50,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -709,16 +709,16 @@
"outputs": [],
"source": [
"my_maps = load_patches(\n",
" \"./patches_100_pixel/*74488689*png\", parent_paths=\"./maps/map_74488689.png\"\n",
" \"../patches_100_pixel/*74488689*png\", parent_paths=\"../maps/map_74488689.png\"\n",
")\n",
"\n",
"my_maps.add_metadata(\"./maps/metadata.csv\", ignore_mismatch=True)\n",
"my_maps.add_metadata(\"../maps/metadata.csv\", ignore_mismatch=True)\n",
"my_maps.add_metadata(\"patch_df.csv\", tree_level=\"patch\", ignore_mismatch=True)"
]
},
{
"cell_type": "code",
"execution_count": 54,
"execution_count": 52,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -735,7 +735,7 @@
},
{
"cell_type": "code",
"execution_count": 55,
"execution_count": 53,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -744,7 +744,7 @@
},
{
"cell_type": "code",
"execution_count": 56,
"execution_count": 54,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -755,34 +755,12 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"## Load dataset in to new Classifier (or use existing one if continuing with notebook)"
"## Load dataset in to Classifier"
]
},
{
"cell_type": "code",
"execution_count": 57,
"metadata": {},
"outputs": [],
"source": [
"from mapreader import ClassifierContainer"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"my_classifier = ClassifierContainer(\n",
" model=None,\n",
" labels_map=None,\n",
" load_path=\"./models_tutorial/checkpoint_10.pkl\",\n",
")"
]
},
{
"cell_type": "code",
"execution_count": 59,
"execution_count": 55,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -851,7 +829,7 @@
},
{
"cell_type": "code",
"execution_count": 64,
"execution_count": 60,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -870,7 +848,7 @@
},
{
"cell_type": "code",
"execution_count": 65,
"execution_count": 61,
"metadata": {},
"outputs": [],
"source": [
Expand Down
Loading

0 comments on commit 5253539

Please sign in to comment.