Image Classification
Transformers
Safetensors
English
swin
vision
Inference Endpoints
NeuronZero commited on
Commit
4a2ad50
1 Parent(s): 27a9414

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +36 -14
README.md CHANGED
@@ -1,26 +1,48 @@
1
  ---
 
2
  tags:
3
- - autotrain
4
  - image-classification
5
- - medical
6
- widget:
7
- - src: https://huggingface.co/datasets/mishig/sample_images/resolve/main/tiger.jpg
8
- example_title: Tiger
9
- - src: https://huggingface.co/datasets/mishig/sample_images/resolve/main/teapot.jpg
10
- example_title: Teapot
11
- - src: https://huggingface.co/datasets/mishig/sample_images/resolve/main/palace.jpg
12
- example_title: Palace
13
  datasets:
14
  - sartajbhuvaji/Brain-Tumor-Classification
15
- license: apache-2.0
16
  language:
17
  - en
18
  pipeline_tag: image-classification
19
  ---
20
 
21
- # Model Trained Using AutoTrain
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22
 
23
- - Problem type: Image Classification
 
24
 
25
- ## Validation Metrics
26
- No validation metrics available
 
 
 
 
 
 
1
  ---
2
+ license: apache-2.0
3
  tags:
4
+ - vision
5
  - image-classification
 
 
 
 
 
 
 
 
6
  datasets:
7
  - sartajbhuvaji/Brain-Tumor-Classification
 
8
  language:
9
  - en
10
  pipeline_tag: image-classification
11
  ---
12
 
13
+ # MRI-Reader(small-sized model)
14
+
15
+ MRI-Reader is a fine-tuned version of [swin-base](https://huggingface.co/microsoft/swin-base-patch4-window7-224-in22k). It was introduced in this [paper](https://arxiv.org/abs/2103.14030) by Liu et al. and first released in this [repository](https://github.com/microsoft/Swin-Transformer).
16
+
17
+
18
+ ## Model description
19
+
20
+ The Swin Transformer is a type of Vision Transformer. It builds hierarchical feature maps by merging image patches (shown in gray) in deeper layers and has linear computation complexity to input image size due to computation of self-attention only within each local window (shown in red). It can thus serve as a general-purpose backbone for both image classification and dense recognition tasks. In contrast, previous vision Transformers produce feature maps of a single low resolution and have quadratic computation complexity to input image size due to computation of self-attention globally.
21
+
22
+ ![model image](https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/swin_transformer_architecture.png)
23
+
24
+ [Source](https://paperswithcode.com/method/swin-transformer)
25
+
26
+
27
+ ### How to use
28
+
29
+ Here is how to use this model to classify an image of the COCO 2017 dataset into one of the 1,000 ImageNet classes:
30
+
31
+ ```python
32
+ from transformers import AutoImageProcessor, SwinForImageClassification
33
+ from PIL import Image
34
+ import requests
35
+
36
+ url = "http://images.cocodataset.org/val2017/000000039769.jpg"
37
+ image = Image.open(requests.get(url, stream=True).raw)
38
 
39
+ processor = AutoImageProcessor.from_pretrained("microsoft/swin-base-patch4-window7-224-in22k")
40
+ model = SwinForImageClassification.from_pretrained("microsoft/swin-base-patch4-window7-224-in22k")
41
 
42
+ inputs = processor(images=image, return_tensors="pt")
43
+ outputs = model(**inputs)
44
+ logits = outputs.logits
45
+ # model predicts one of the 1000 ImageNet classes
46
+ predicted_class_idx = logits.argmax(-1).item()
47
+ print("Predicted class:", model.config.id2label[predicted_class_idx])
48
+ ```