maxwoe commited on
Commit
35fbe56
·
verified ·
1 Parent(s): fd9bd2c

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +11 -5
README.md CHANGED
@@ -6,12 +6,12 @@ tags:
6
  - angle-detection
7
  - circular-gaussian-distribution
8
  - mambaout
 
9
  datasets:
10
  - coco
11
  metrics:
12
  - mae
13
  pipeline_tag: image-classification
14
- library_name: pytorch
15
  ---
16
 
17
  # Image Rotation Angle Estimation
@@ -31,12 +31,18 @@ The model outputs a probability distribution over 360 angle bins (1 degree resol
31
 
32
  ## Usage
33
 
 
 
34
  ```python
35
- import torch
36
- from huggingface_hub import hf_hub_download
37
  from PIL import Image
38
 
39
- # Download checkpoint
 
 
 
 
 
40
  ckpt_path = hf_hub_download(
41
  repo_id="maxwoe/image-rotation-angle-estimation",
42
  filename="cgd_mambaout_base_coco2017.ckpt",
@@ -45,7 +51,7 @@ ckpt_path = hf_hub_download(
45
  # Load model
46
  from model_cgd import CGDAngleEstimation
47
 
48
- model = CGDAngleEstimation.load_from_checkpoint(ckpt_path, image_size=224)
49
  model.eval()
50
 
51
  # Predict rotation angle
 
6
  - angle-detection
7
  - circular-gaussian-distribution
8
  - mambaout
9
+ - pytorch
10
  datasets:
11
  - coco
12
  metrics:
13
  - mae
14
  pipeline_tag: image-classification
 
15
  ---
16
 
17
  # Image Rotation Angle Estimation
 
31
 
32
  ## Usage
33
 
34
+ The inference code (`model_cgd.py`, `architectures.py`, `rotation_utils.py`) is included in this repo.
35
+
36
  ```python
37
+ from huggingface_hub import hf_hub_download, snapshot_download
 
38
  from PIL import Image
39
 
40
+ # Download inference code and checkpoint
41
+ snapshot_download(
42
+ repo_id="maxwoe/image-rotation-angle-estimation",
43
+ allow_patterns=["*.py", "*.json"],
44
+ local_dir=".",
45
+ )
46
  ckpt_path = hf_hub_download(
47
  repo_id="maxwoe/image-rotation-angle-estimation",
48
  filename="cgd_mambaout_base_coco2017.ckpt",
 
51
  # Load model
52
  from model_cgd import CGDAngleEstimation
53
 
54
+ model = CGDAngleEstimation.try_load(checkpoint_path=ckpt_path)
55
  model.eval()
56
 
57
  # Predict rotation angle