stupidog04
commited on
Commit
•
4597662
1
Parent(s):
dc8eadb
commit files to HF hub
Browse files- README.md +41 -41
- pipeline.py +29 -0
- pytorch_model.bin +1 -1
- runs/events.out.tfevents.1666948795.sa103.19420.0 +3 -0
README.md
CHANGED
@@ -1,56 +1,56 @@
|
|
1 |
---
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
metrics:
|
7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
|
9 |
-
model-index:
|
10 |
-
- name: krenzcolor_chkpt_classifier
|
11 |
-
results:
|
12 |
-
- task:
|
13 |
-
name: Image Classification
|
14 |
-
type: image-classification
|
15 |
-
metrics:
|
16 |
-
- name: Accuracy
|
17 |
-
type: accuracy
|
18 |
-
value: 0.4107142984867096
|
19 |
-
---
|
20 |
|
21 |
-
|
22 |
|
23 |
-
|
24 |
-
Autogenerated by HuggingPics🤗🖼️
|
25 |
|
26 |
-
|
27 |
|
28 |
-
|
29 |
-
|
30 |
|
31 |
-
|
32 |
|
33 |
-
|
34 |
-
#### chk1_fail
|
35 |
|
36 |
-
|
37 |
-
|
38 |
-
#### chk1_pass
|
39 |
|
40 |
-
|
41 |
-
|
42 |
-
#### chk2_fail
|
43 |
|
44 |
-
|
45 |
-
|
46 |
-
#### chk2_pass
|
47 |
|
48 |
-
|
49 |
-
|
50 |
-
#### chk3_fail
|
51 |
|
52 |
-
|
53 |
-
|
54 |
-
#### chk3_pass
|
55 |
|
56 |
-
|
|
|
1 |
---
|
2 |
+
tags:
|
3 |
+
- image-classification
|
4 |
+
- pytorch
|
5 |
+
- huggingpics
|
6 |
+
metrics:
|
7 |
+
- accuracy
|
8 |
+
|
9 |
+
model-index:
|
10 |
+
- name: krenzcolor_chkpt_classifier
|
11 |
+
results:
|
12 |
+
- task:
|
13 |
+
name: Image Classification
|
14 |
+
type: image-classification
|
15 |
metrics:
|
16 |
+
- name: Accuracy
|
17 |
+
type: accuracy
|
18 |
+
value: 0.3660714328289032
|
19 |
+
---
|
20 |
+
|
21 |
+
# krenzcolor_chkpt_classifier
|
22 |
+
|
23 |
+
|
24 |
+
Autogenerated by HuggingPics🤗🖼️
|
25 |
+
|
26 |
+
Create your own image classifier for **anything** by running [the demo on Google Colab](https://colab.research.google.com/github/nateraw/huggingpics/blob/main/HuggingPics.ipynb).
|
27 |
+
|
28 |
+
Report any issues with the demo at the [github repo](https://github.com/nateraw/huggingpics).
|
29 |
+
|
30 |
+
|
31 |
+
## Example Images
|
32 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
|
34 |
+
#### chk1_fail
|
35 |
|
36 |
+
![chk1_fail](images/chk1_fail.jpg)
|
|
|
37 |
|
38 |
+
#### chk1_pass
|
39 |
|
40 |
+
![chk1_pass](images/chk1_pass.jpg)
|
|
|
41 |
|
42 |
+
#### chk2_fail
|
43 |
|
44 |
+
![chk2_fail](images/chk2_fail.jpg)
|
|
|
45 |
|
46 |
+
#### chk2_pass
|
|
|
|
|
47 |
|
48 |
+
![chk2_pass](images/chk2_pass.jpg)
|
|
|
|
|
49 |
|
50 |
+
#### chk3_fail
|
|
|
|
|
51 |
|
52 |
+
![chk3_fail](images/chk3_fail.jpg)
|
|
|
|
|
53 |
|
54 |
+
#### chk3_pass
|
|
|
|
|
55 |
|
56 |
+
![chk3_pass](images/chk3_pass.jpg)
|
pipeline.py
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from torchvision import transforms
|
2 |
+
from transformers import ImageClassificationPipeline
|
3 |
+
import torch
|
4 |
+
|
5 |
+
|
6 |
+
class PairClassificationPipeline(ImageClassificationPipeline):
|
7 |
+
pipe_to_tensor = transforms.ToTensor()
|
8 |
+
pipe_to_pil = transforms.ToPILImage()
|
9 |
+
|
10 |
+
def preprocess(self, image):
|
11 |
+
left_image, right_image = self.horizontal_split_image(image)
|
12 |
+
model_inputs = self.extract_split_feature(left_image, right_image)
|
13 |
+
# model_inputs = super().preprocess(image)
|
14 |
+
# print(model_inputs['pixel_values'].shape)
|
15 |
+
return model_inputs
|
16 |
+
|
17 |
+
def horizontal_split_image(self, image):
|
18 |
+
# image = image.resize((448,224))
|
19 |
+
w, h = image.size
|
20 |
+
half_w = w//2
|
21 |
+
left_image = image.crop([0,0,half_w,h])
|
22 |
+
right_image = image.crop([half_w,0,2*half_w,h])
|
23 |
+
return left_image, right_image
|
24 |
+
|
25 |
+
def extract_split_feature(self, left_image, right_image):
|
26 |
+
model_inputs = self.feature_extractor(images=left_image, return_tensors=self.framework)
|
27 |
+
right_inputs = self.feature_extractor(images=right_image, return_tensors=self.framework)
|
28 |
+
model_inputs['pixel_values'] = torch.cat([model_inputs['pixel_values'],right_inputs['pixel_values']], dim=1)
|
29 |
+
return model_inputs
|
pytorch_model.bin
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
size 345635761
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:bd2436113144beab5306786c895791cf7fb2d1c0576141e488afe76f3051b3b3
|
3 |
size 345635761
|
runs/events.out.tfevents.1666948795.sa103.19420.0
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:e3ff8d1a0090a2b793bbfcaf4fbea28f64137603576682c57e343014ada12fc8
|
3 |
+
size 1939
|