roobee79 commited on
Commit
1412aa2
Β·
verified Β·
1 Parent(s): 5131e6b

v2.0: update README, config and licenses; old weights kept under tag v1.0

Browse files
Files changed (6) hide show
  1. HNE2cell_pub_patch73_jit.pt +0 -3
  2. LICENSE +21 -0
  3. MODEL_LICENSE +18 -0
  4. README.md +33 -11
  5. config.json +2 -1
  6. inference.py +1 -1
HNE2cell_pub_patch73_jit.pt DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:0a152d9ed4b6200f468c25c57095d68bfc071f272a14c100e18a43a218beaa32
3
- size 5138307026
 
 
 
 
LICENSE ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ MIT License
2
+
3
+ Copyright (c) 2026 The HNE2Cell authors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
MODEL_LICENSE ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ HNE2Cell model weights
2
+
3
+ Copyright (c) 2026 The HNE2Cell authors
4
+
5
+ The model weights in this repository (HNE2Cell_v2_jit.pt and, under the v1.0 tag,
6
+ HNE2cell_pub_patch73_jit.pt) are licensed under the Creative Commons
7
+ Attribution-NonCommercial 4.0 International License (CC BY-NC 4.0).
8
+
9
+ You may share and adapt the weights for non-commercial purposes, provided that you
10
+ give appropriate credit, provide a link to the license and indicate if changes were
11
+ made. Commercial use is not permitted under this license.
12
+
13
+ Full license text: https://creativecommons.org/licenses/by-nc/4.0/legalcode
14
+
15
+ For commercial licensing, contact the Ewha University-Industry Collaboration
16
+ Foundation, Technology Commercialization Team, Ewha Womans University,
17
+ 52 Ewhayeodae-gil, Seodaemun-gu, Seoul, Republic of Korea
18
+ (https://research.ewha.ac.kr).
README.md CHANGED
@@ -1,5 +1,5 @@
1
  ---
2
- license: apache-2.0
3
  pipeline_tag: image-segmentation
4
  tags:
5
  - cell-classification
@@ -120,20 +120,20 @@ days even on a high-core-count CPU.
120
 
121
  ## Installation Guide
122
 
123
- ### Recommended: Conda environment from `cellvit_rv3.yml`
124
 
125
  The repository includes a frozen conda environment file with all dependencies pinned
126
  to the exact versions used in the manuscript.
127
 
128
  ```bash
129
  # 1. Download environment file
130
- wget https://huggingface.co/roobee79/HNE2Cell/resolve/main/cellvit_rv3.yml
131
 
132
  # 2. Create environment
133
- conda env create -f cellvit_rv3.yml
134
 
135
  # 3. Activate
136
- conda activate cellvit_rv3
137
  ```
138
 
139
  **Typical install time:** ~10–15 minutes on a Linux server with a stable network connection
@@ -147,7 +147,7 @@ from huggingface_hub import hf_hub_download
147
 
148
  model_path = hf_hub_download(
149
  repo_id="roobee79/HNE2Cell",
150
- filename="HNE2cell_pub_patch73_jit.pt"
151
  )
152
  ```
153
 
@@ -169,7 +169,7 @@ config_path = hf_hub_download(repo_id=REPO_ID, filename="config.json")
169
 
170
  model_path = hf_hub_download(
171
  repo_id=REPO_ID,
172
- filename="HNE2cell_pub_patch73_jit.pt"
173
  )
174
 
175
  slide_path = hf_hub_download(
@@ -207,7 +207,7 @@ python patchify.py \
207
  python inference.py \
208
  --input_dir ./example/slides/TCGA-56-8628-01Z-00-DX1.../patches \
209
  --output_dir ./example/results \
210
- --model_path ./HNE2cell_pub_patch73_jit.pt \
211
  --magnification 40 \
212
  --batch_size 32
213
  ```
@@ -261,7 +261,7 @@ python patchify.py \
261
  python inference.py \
262
  --input_dir /path/to/patch_folders \
263
  --output_dir /path/to/results \
264
- --model_path ./HNE2cell_pub_patch73_jit.pt \
265
  --magnification 40 \
266
  --batch_size 32
267
  ```
@@ -320,7 +320,11 @@ included in this repository, or you can supply your own.
320
  ```
321
  HNE2Cell/
322
  β”œβ”€β”€ README.md # This file
323
- β”œβ”€β”€ HNE2cell_pub_patch73_jit.pt # TorchScript model
 
 
 
 
324
  β”œβ”€β”€ normalize.py # Step 1: Reinhard normalization
325
  β”œβ”€β”€ patchify.py # Step 2: Patch extraction
326
  β”œβ”€β”€ inference.py # Step 3: Model inference
@@ -333,6 +337,24 @@ HNE2Cell/
333
  ---
334
 
335
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
336
  ## Citation
337
 
338
  If you use HNE2Cell in your research, please cite:
@@ -354,7 +376,7 @@ The example slide is derived from data generated by the TCGA:
354
  This repository uses a dual licensing scheme commonly adopted in academic ML/biomedical projects (e.g., SAM, LLaMA):
355
 
356
  - **Source code** (`.py` files): Released under the **MIT License**. See `LICENSE`.
357
- - **Model weights** (`HNE2cell_pub_patch73_jit.pt`): Released under
358
  **Creative Commons Attribution-NonCommercial 4.0 International (CC BY-NC 4.0)**.
359
  See `MODEL_LICENSE`. Free for academic and non-commercial research use.
360
 
 
1
  ---
2
+ license: cc-by-nc-4.0
3
  pipeline_tag: image-segmentation
4
  tags:
5
  - cell-classification
 
120
 
121
  ## Installation Guide
122
 
123
+ ### Recommended: Conda environment from `environment.yml`
124
 
125
  The repository includes a frozen conda environment file with all dependencies pinned
126
  to the exact versions used in the manuscript.
127
 
128
  ```bash
129
  # 1. Download environment file
130
+ wget https://huggingface.co/roobee79/HNE2Cell/resolve/main/environment.yml
131
 
132
  # 2. Create environment
133
+ conda env create -f environment.yml
134
 
135
  # 3. Activate
136
+ conda activate hne2cell
137
  ```
138
 
139
  **Typical install time:** ~10–15 minutes on a Linux server with a stable network connection
 
147
 
148
  model_path = hf_hub_download(
149
  repo_id="roobee79/HNE2Cell",
150
+ filename="HNE2Cell_v2_jit.pt"
151
  )
152
  ```
153
 
 
169
 
170
  model_path = hf_hub_download(
171
  repo_id=REPO_ID,
172
+ filename="HNE2Cell_v2_jit.pt"
173
  )
174
 
175
  slide_path = hf_hub_download(
 
207
  python inference.py \
208
  --input_dir ./example/slides/TCGA-56-8628-01Z-00-DX1.../patches \
209
  --output_dir ./example/results \
210
+ --model_path ./HNE2Cell_v2_jit.pt \
211
  --magnification 40 \
212
  --batch_size 32
213
  ```
 
261
  python inference.py \
262
  --input_dir /path/to/patch_folders \
263
  --output_dir /path/to/results \
264
+ --model_path ./HNE2Cell_v2_jit.pt \
265
  --magnification 40 \
266
  --batch_size 32
267
  ```
 
320
  ```
321
  HNE2Cell/
322
  β”œβ”€β”€ README.md # This file
323
+ β”œβ”€β”€ config.json # Model configuration
324
+ β”œβ”€β”€ environment.yml # Conda environment
325
+ β”œβ”€β”€ LICENSE # MIT License (code)
326
+ β”œβ”€β”€ MODEL_LICENSE # CC BY-NC 4.0 (model weights)
327
+ β”œβ”€β”€ HNE2Cell_v2_jit.pt # TorchScript model (v2.0)
328
  β”œβ”€β”€ normalize.py # Step 1: Reinhard normalization
329
  β”œβ”€β”€ patchify.py # Step 2: Patch extraction
330
  β”œβ”€β”€ inference.py # Step 3: Model inference
 
337
  ---
338
 
339
 
340
+ ## Model versions
341
+
342
+ | Version | Weights file | Status |
343
+ |---|---|---|
344
+ | **v2.0** (current, `main`) | `HNE2Cell_v2_jit.pt` | Model described in the revised manuscript. Retrained after correction of the cell-type labels, using the public training atlas only. |
345
+ | v1.0 (tag `v1.0`) | `HNE2cell_pub_patch73_jit.pt` | Superseded. Kept for reproducibility of the original submission. |
346
+
347
+ The previous weights remain available from the `v1.0` tag:
348
+
349
+ ```python
350
+ from huggingface_hub import hf_hub_download
351
+ hf_hub_download(repo_id="roobee79/HNE2Cell", filename="HNE2cell_pub_patch73_jit.pt", revision="v1.0")
352
+ ```
353
+
354
+ Both versions share the same input format, output classes and inference scripts.
355
+
356
+ ---
357
+
358
  ## Citation
359
 
360
  If you use HNE2Cell in your research, please cite:
 
376
  This repository uses a dual licensing scheme commonly adopted in academic ML/biomedical projects (e.g., SAM, LLaMA):
377
 
378
  - **Source code** (`.py` files): Released under the **MIT License**. See `LICENSE`.
379
+ - **Model weights** (`HNE2Cell_v2_jit.pt`): Released under
380
  **Creative Commons Attribution-NonCommercial 4.0 International (CC BY-NC 4.0)**.
381
  See `MODEL_LICENSE`. Free for academic and non-commercial research use.
382
 
config.json CHANGED
@@ -3,8 +3,9 @@
3
  "architecture": "CellViT",
4
  "task": "image-segmentation",
5
  "description": "H&E whole-slide image cell detection and classification (16 cell types).",
6
- "weights_file": "HNE2cell_pub_patch73_jit.pt",
7
  "weights_format": "torchscript",
 
8
  "framework": "pytorch",
9
  "input_size": [256, 256],
10
  "input_channels": 3,
 
3
  "architecture": "CellViT",
4
  "task": "image-segmentation",
5
  "description": "H&E whole-slide image cell detection and classification (16 cell types).",
6
+ "weights_file": "HNE2Cell_v2_jit.pt",
7
  "weights_format": "torchscript",
8
+ "model_version": "2.0",
9
  "framework": "pytorch",
10
  "input_size": [256, 256],
11
  "input_channels": 3,
inference.py CHANGED
@@ -8,7 +8,7 @@ Usage:
8
  python inference.py \
9
  --input_dir /path/to/patch_folders \
10
  --output_dir /path/to/results \
11
- --model_path ./HNE2cell_all_patch73_jit.pt \
12
  --magnification 40 \
13
  --batch_size 32
14
 
 
8
  python inference.py \
9
  --input_dir /path/to/patch_folders \
10
  --output_dir /path/to/results \
11
+ --model_path ./HNE2Cell_v2_jit.pt \
12
  --magnification 40 \
13
  --batch_size 32
14