BiliSakura commited on
Commit
7d918c2
·
verified ·
1 Parent(s): f18109c

Sync updated code and configs (no weight re-upload)

Browse files
README.md CHANGED
@@ -52,11 +52,13 @@ Legacy `.pth` filename mapping is in [`conversion_manifest.json`](conversion_man
52
 
53
  ## Usage
54
 
 
 
55
  ```python
56
  from transformers import pipeline
57
  import numpy as np
58
 
59
- REPO = "BiliSakura/SATMAE-PP-transformers"
60
  SUBFOLDER = "satmae-pp-vit-large-patch8-fmow-sentinel-pretrain"
61
 
62
  pipe = pipeline(
@@ -66,8 +68,8 @@ pipe = pipeline(
66
  model_kwargs={"subfolder": SUBFOLDER},
67
  )
68
 
69
- # FMoW-Sentinel: 10 bands after dropping bands 0, 9, 10
70
- image = np.random.randint(0, 255, (96, 96, 10), dtype=np.uint8)
71
  features = pipe(image, pool=True, return_tensors=True)
72
  print(features.shape) # [1, 1024]
73
  ```
@@ -82,11 +84,17 @@ pipe = pipeline(
82
  trust_remote_code=True,
83
  model_kwargs={"subfolder": SUBFOLDER},
84
  )
85
- image = np.random.randint(0, 255, (224, 224, 3), dtype=np.uint8)
86
  features = pipe(image, pool=True, return_tensors=True)
87
  print(features.shape) # [1, 1024]
88
  ```
89
 
 
 
 
 
 
 
90
  Load components directly:
91
 
92
  ```python
 
52
 
53
  ## Usage
54
 
55
+ Processors default to **`do_resize: false`**. Inputs keep native height and width; FMoW mean/std normalization still applies when enabled.
56
+
57
  ```python
58
  from transformers import pipeline
59
  import numpy as np
60
 
61
+ REPO = "/path/to/SATMAE-PP-transformers"
62
  SUBFOLDER = "satmae-pp-vit-large-patch8-fmow-sentinel-pretrain"
63
 
64
  pipe = pipeline(
 
68
  model_kwargs={"subfolder": SUBFOLDER},
69
  )
70
 
71
+ # FMoW-Sentinel: 10 bands at native size (e.g. 96×96 or larger)
72
+ image = np.random.randint(0, 255, (128, 128, 10), dtype=np.uint8)
73
  features = pipe(image, pool=True, return_tensors=True)
74
  print(features.shape) # [1, 1024]
75
  ```
 
84
  trust_remote_code=True,
85
  model_kwargs={"subfolder": SUBFOLDER},
86
  )
87
+ image = np.random.randint(0, 255, (384, 384, 3), dtype=np.uint8)
88
  features = pipe(image, pool=True, return_tensors=True)
89
  print(features.shape) # [1, 1024]
90
  ```
91
 
92
+ To resize to the pretraining reference (`96×96` sentinel / `224×224` RGB):
93
+
94
+ ```python
95
+ features = pipe(image, pool=True, return_tensors=True, image_processor_kwargs={"do_resize": True})
96
+ ```
97
+
98
  Load components directly:
99
 
100
  ```python
satmae-pp-vit-large-patch16-fmow-rgb-pretrain/__pycache__/modeling_satmae_pp.cpython-311.pyc ADDED
Binary file (20.7 kB). View file
 
satmae-pp-vit-large-patch16-fmow-rgb-pretrain/image_processing_satmae_pp.py CHANGED
@@ -74,7 +74,7 @@ class SatMAEppImageProcessor(BaseImageProcessor):
74
 
75
  def __init__(
76
  self,
77
- do_resize: bool = True,
78
  size: Optional[dict[str, int]] = None,
79
  resample: PILImageResampling = PILImageResampling.BILINEAR,
80
  do_rescale: bool = False,
 
74
 
75
  def __init__(
76
  self,
77
+ do_resize: bool = False,
78
  size: Optional[dict[str, int]] = None,
79
  resample: PILImageResampling = PILImageResampling.BILINEAR,
80
  do_rescale: bool = False,
satmae-pp-vit-large-patch16-fmow-rgb-pretrain/preprocessor_config.json CHANGED
@@ -4,7 +4,7 @@
4
  "height": 224,
5
  "width": 224
6
  },
7
- "do_resize": true,
8
  "do_rescale": false,
9
  "do_normalize": true,
10
  "do_convert_rgb": false,
 
4
  "height": 224,
5
  "width": 224
6
  },
7
+ "do_resize": false,
8
  "do_rescale": false,
9
  "do_normalize": true,
10
  "do_convert_rgb": false,
satmae-pp-vit-large-patch8-fmow-sentinel-pretrain/image_processing_satmae_pp.py CHANGED
@@ -74,7 +74,7 @@ class SatMAEppImageProcessor(BaseImageProcessor):
74
 
75
  def __init__(
76
  self,
77
- do_resize: bool = True,
78
  size: Optional[dict[str, int]] = None,
79
  resample: PILImageResampling = PILImageResampling.BILINEAR,
80
  do_rescale: bool = False,
 
74
 
75
  def __init__(
76
  self,
77
+ do_resize: bool = False,
78
  size: Optional[dict[str, int]] = None,
79
  resample: PILImageResampling = PILImageResampling.BILINEAR,
80
  do_rescale: bool = False,
satmae-pp-vit-large-patch8-fmow-sentinel-pretrain/preprocessor_config.json CHANGED
@@ -4,7 +4,7 @@
4
  "height": 96,
5
  "width": 96
6
  },
7
- "do_resize": true,
8
  "do_rescale": false,
9
  "do_normalize": true,
10
  "do_convert_rgb": false,
 
4
  "height": 96,
5
  "width": 96
6
  },
7
+ "do_resize": false,
8
  "do_rescale": false,
9
  "do_normalize": true,
10
  "do_convert_rgb": false,