mapreader 1.8.2.post0.dev9__py3-none-any.whl → 1.8.2.post0.dev15__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
mapreader/_version.py CHANGED
@@ -8,11 +8,11 @@ import json
8
8
 
9
9
  version_json = '''
10
10
  {
11
- "date": "2026-02-26T15:15:54+0000",
11
+ "date": "2026-03-25T21:06:12+0000",
12
12
  "dirty": false,
13
13
  "error": null,
14
- "full-revisionid": "87578a471ab1dcadf80a2552aa31a3f50cac862a",
15
- "version": "1.8.2.post0.dev9"
14
+ "full-revisionid": "08fceec9e3feef2a5c60385dba516f7639897f03",
15
+ "version": "1.8.2.post0.dev15"
16
16
  }
17
17
  ''' # END VERSION_JSON
18
18
 
@@ -108,6 +108,7 @@ class ClassifierContainer:
108
108
  is_inception: bool = False,
109
109
  load_path: str | None = None,
110
110
  force_device: bool = False,
111
+ huggingface: bool = False,
111
112
  **kwargs,
112
113
  ):
113
114
  # set up device
@@ -149,7 +150,31 @@ class ClassifierContainer:
149
150
  self.input_size = input_size
150
151
  self.is_inception = is_inception
151
152
  elif isinstance(model, str):
152
- self._initialize_model(model, **kwargs)
153
+ if huggingface:
154
+ try:
155
+ from transformers import AutoModelForImageClassification, AutoImageProcessor
156
+ except ImportError:
157
+ raise ImportError(
158
+ "Hugging Face models require the 'transformers' library: 'pip install transformers'."
159
+ )
160
+ print(f"[INFO] Initializing Hugging Face model: {model}")
161
+ num_labels = len(self.labels_map)
162
+ self.model = AutoModelForImageClassification.from_pretrained(
163
+ model,
164
+ num_labels=num_labels,
165
+ ignore_mismatched_sizes=True
166
+ ).to(self.device)
167
+ hf_processor = AutoImageProcessor.from_pretrained(model)
168
+ size = getattr(hf_processor, "size", {})
169
+ if "height" in size and "width" in size:
170
+ size = (size["height"], size["width"])
171
+ elif "shortest_edge" in size:
172
+ size = (size["shortest_edge"], size["shortest_edge"])
173
+ else:
174
+ size = input_size
175
+ self.is_inception = False
176
+ else:
177
+ self._initialize_model(model, **kwargs)
153
178
 
154
179
  self.optimizer = None
155
180
  self.scheduler = None
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mapreader
3
- Version: 1.8.2.post0.dev9
3
+ Version: 1.8.2.post0.dev15
4
4
  Summary: A computer vision pipeline for the semantic exploration of maps/images at scale
5
5
  Home-page: https://github.com/Living-with-machines/MapReader
6
6
  Download-URL: https://github.com/Living-with-machines/MapReader/archive/refs/heads/main.zip
@@ -1,10 +1,10 @@
1
1
  mapreader/__init__.py,sha256=ztmWx0OCneJzlu2L1CP7NPwieGYv1kvARJJOUzq_6OQ,1720
2
2
  mapreader/__main__.py,sha256=hKOJEZkRPHZ-wwwz_RRR5OxMK5UilAfbQlq6k9icl_I,112
3
- mapreader/_version.py,sha256=ojxsMkAf2NCXx9VAS0VvM2OgHg_yI_oq5FRlU_gaz78,508
3
+ mapreader/_version.py,sha256=j0h4Cm-RpugAeKh-aYpb1J_eILj79Su2Bk1LQUjZ6iA,509
4
4
  mapreader/annotate/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
5
  mapreader/annotate/annotator.py,sha256=x2K8yn2WXYOMTajgSQ-iXff4cIzUQHaYJUpw0S7AIzI,37508
6
6
  mapreader/classify/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
- mapreader/classify/classifier.py,sha256=P--3keloxsHSMUhHCquLTFfEMO-t0LKWUu5k34fr5bY,71173
7
+ mapreader/classify/classifier.py,sha256=NIJ-VFWr0YW6Nug7hWovcmCbiEEw-tZcdNbmo02IBDU,72502
8
8
  mapreader/classify/custom_models.py,sha256=1qwlpUjIIdD-syCt7CA-4HSNUfVAgISR-MPQI7taA-w,2170
9
9
  mapreader/classify/datasets.py,sha256=stwIndSOomU5yFl_Ay2m6e2QYO0XHrtRWaUWdNCKcXg,30442
10
10
  mapreader/classify/load_annotations.py,sha256=kVvyVkBSzmEfRXV5hM8dN-EkP9cgu5bR6kS5Chipf1I,34887
@@ -34,9 +34,9 @@ mapreader/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
34
34
  mapreader/utils/compute_and_save_stats.py,sha256=bOI6FfnzLWwtx8YOY-A7xN1mK1Thx7De-FANGJ2BNRY,979
35
35
  mapreader/utils/load_frames.py,sha256=o4QztKbf8FBs6cxDHtx-ypwIMZRf4px6q1aKD5kZLwI,3558
36
36
  mapreader/utils/slice_parallel.py,sha256=jXHYZ811IiKBPOKPI40IYeSA9RHC7evo61H44fbPXhI,1634
37
- mapreader-1.8.2.post0.dev9.dist-info/licenses/LICENSE,sha256=lZ12qYK_-T-58n5YueZUgyxZQpz4kJzGCJwAI9e2rXA,1215
38
- mapreader-1.8.2.post0.dev9.dist-info/METADATA,sha256=yWDDXJrft2aCJIzvF10NClUj3yOqPONE-eoioQ0XCMQ,15833
39
- mapreader-1.8.2.post0.dev9.dist-info/WHEEL,sha256=YCfwYGOYMi5Jhw2fU4yNgwErybb2IX5PEwBKV4ZbdBo,91
40
- mapreader-1.8.2.post0.dev9.dist-info/entry_points.txt,sha256=oJAMoNzUMr-iGOli2-o2hlzYbyPPM_eVHQDFrijQvz8,54
41
- mapreader-1.8.2.post0.dev9.dist-info/top_level.txt,sha256=Z1DD0SVhh767afeDuV7blzVA6sYl0-71K81-ld4EbKY,10
42
- mapreader-1.8.2.post0.dev9.dist-info/RECORD,,
37
+ mapreader-1.8.2.post0.dev15.dist-info/licenses/LICENSE,sha256=lZ12qYK_-T-58n5YueZUgyxZQpz4kJzGCJwAI9e2rXA,1215
38
+ mapreader-1.8.2.post0.dev15.dist-info/METADATA,sha256=4O1ltwJEC6nfAa5bjUVyP5jmi4hnFFIUZZJP_Yc6P8s,15834
39
+ mapreader-1.8.2.post0.dev15.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
40
+ mapreader-1.8.2.post0.dev15.dist-info/entry_points.txt,sha256=oJAMoNzUMr-iGOli2-o2hlzYbyPPM_eVHQDFrijQvz8,54
41
+ mapreader-1.8.2.post0.dev15.dist-info/top_level.txt,sha256=Z1DD0SVhh767afeDuV7blzVA6sYl0-71K81-ld4EbKY,10
42
+ mapreader-1.8.2.post0.dev15.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (82.0.0)
2
+ Generator: setuptools (82.0.1)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5