Smaranjit Ghose commited on
Commit
84a6cc5
1 Parent(s): e66e641

Reformatted the sample image display

Browse files
Files changed (1) hide show
  1. README.md +16 -29
README.md CHANGED
@@ -18,37 +18,26 @@ model-index:
18
  value: 0.9107142686843872
19
  ---
20
 
21
- # Big Cat Classifier 🐯
22
-
23
- An image classifier that categories between the 5 members of the big cat family i.e.
24
-
25
- 1) __Cheetah__
26
-
27
- ![cheetah](images/cheetah.jpg)
28
-
29
- 2) __Jaguar__
30
-
31
- ![jaguar](images/jaguar.jpg)
32
-
33
- 3) __Leopard__
34
 
35
- ![leopard](images/leopard.jpg)
36
 
37
- 4) __Lion__
38
-
39
- ![lion](images/lion.jpg)
40
-
41
- 5) __Tiger__
42
 
43
- ![tiger](images/tiger.jpg)
44
 
 
 
 
 
 
 
 
45
 
46
- A visual transformer is used as the base model. After fine-tuning, the classifier was trained for 10 epochs and obtained an accuracy of 0.911
47
 
48
  > __Note__:
49
- > - While the identification of a lion or a tiger is fairly simple, the ability of the model is tested when it has to accurately distinguish between a leopard, cheetah, and jaguar
50
- > - Since the model has been trained on a small dataset of approximately 500 images (in total), testing on various subspecies found among the populations of each member of the big cats is to be done. For example, The robustness of the model to classify all Bengal Tigers, Siberian Tigers, Indochinese Tigers, and Malayan Tigers as Tigers
51
- > - Lastly, the performance of the model in categorizing certain rare variants in the populations of big cats such as white tigers, snow leopards or black jaguar has not been determined exclusively.
 
52
 
53
  ## Usage
54
 
@@ -64,7 +53,7 @@ def identify_big_cat(img_path:str)->str:
64
  img = Image.open(img_path)
65
  model_panthera = ViTForImageClassification.from_pretrained("smaranjitghose/big-cat-classifier")
66
  feature_extractor = ViTFeatureExtractor.from_pretrained('smaranjitghose/big-cat-classifier')
67
- inputs = feature_extractor(images=image, return_tensors="pt")
68
  outputs = model_panthera(**inputs)
69
  logits = outputs.logits
70
  predicted_class_idx = logits.argmax(-1).item()
@@ -73,11 +62,9 @@ def identify_big_cat(img_path:str)->str:
73
 
74
  our_big_cat = identify_big_cat("path_of_the_image")
75
  print(f"Predicted species: {our_big_cat}" )
76
-
77
-
78
-
79
  ```
80
 
81
  ## Reference and Acknowledgement:
82
 
83
- [Hugging Pics](https://github.com/nateraw/huggingpics)
 
 
18
  value: 0.9107142686843872
19
  ---
20
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
 
 
22
 
23
+ # Big Cat Classifier 🐯
 
 
 
 
24
 
25
+ An image classifier built using Vision Transformers that categories images of the big cats into the following classes:
26
 
27
+ |Class| Big Cat |Sample Image|
28
+ |:---:|:--------|-------------------------------|
29
+ | 0 | Cheetah |![cheetah](./images/cheetah.jpg) |
30
+ | 1 | Jaguar |![jaguar](./images/jaguar.jpg) |
31
+ | 2 | Leopard |![leopard](./images/leopard.jpg) |
32
+ | 3 | Lion |![lion](./images/lion.jpg) |
33
+ | 4 | Tiger |![tiger](./images/tiger.jpg) |
34
 
 
35
 
36
  > __Note__:
37
+ > - Since jaguars and leopards have similar appearances, the model might confuse the two. These [[1](https://www.nationalgeographic.com/animals/article/animals-big-cats-jaguars-leopards)] [[2](https://safarisafricana.com/jaguar-v-leopard/)] two articles throw some light on the difference between the two species.
38
+ > - Theoretically the model should be able to accurately identify geographical population variants of each species. However, in practical scenarios this may not be true as during the training phases this was not kept in mind while collecting the dataset.
39
+ > - For example: images of Bengal Tigers, Siberian Tigers, Indochinese Tigers, and Malayan Tigers should be identified as Tigers
40
+ > - Lastly, the performance of the model in categorizing certain rare variants in the populations of big cats such as white tigers, snow leopards, or black panther has not been determined exclusively. Although some of the tests performed gave satisfactory results.
41
 
42
  ## Usage
43
 
 
53
  img = Image.open(img_path)
54
  model_panthera = ViTForImageClassification.from_pretrained("smaranjitghose/big-cat-classifier")
55
  feature_extractor = ViTFeatureExtractor.from_pretrained('smaranjitghose/big-cat-classifier')
56
+ inputs = feature_extractor(images=img, return_tensors="pt")
57
  outputs = model_panthera(**inputs)
58
  logits = outputs.logits
59
  predicted_class_idx = logits.argmax(-1).item()
 
62
 
63
  our_big_cat = identify_big_cat("path_of_the_image")
64
  print(f"Predicted species: {our_big_cat}" )
 
 
 
65
  ```
66
 
67
  ## Reference and Acknowledgement:
68
 
69
+ [Hugging Pics](https://github.com/nateraw/huggingpics)
70
+