Views
No views yet

| Class | Big Cat | Sample Image |
|---|---|---|
| 0 | Cheetah | ![]() |
| 1 | Jaguar | ![]() |
| 2 | Leopard | ![]() |
| 3 | Lion | ![]() |
| 4 | Tiger | ![]() |
Note:
- Since jaguars and leopards have similar appearances, the model might confuse the two. These [1] [2] two articles throw some light on the difference between the two species.
- 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.
- For example: images of Bengal Tigers, Siberian Tigers, Indochinese Tigers, and Malayan Tigers should be identified as Tigers
- 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.
1from PIL import Image
2import matplotlib.pyplot as plt
3from transformers import ViTFeatureExtractor, ViTForImageClassification
4
5def identify_big_cat(img_path:str)->str:
6 """
7 Function that reads an image of a big cat (belonging to Panthera family) and returns the corresponding species
8 """
9 img = Image.open(img_path)
10 model_panthera = ViTForImageClassification.from_pretrained("smaranjitghose/big-cat-classifier")
11 feature_extractor = ViTFeatureExtractor.from_pretrained('smaranjitghose/big-cat-classifier')
12 inputs = feature_extractor(images=img, return_tensors="pt")
13 outputs = model_panthera(**inputs)
14 logits = outputs.logits
15 predicted_class_idx = logits.argmax(-1).item()
16 return model_panthera.config.id2label[predicted_class_idx]
17
18
19 our_big_cat = identify_big_cat("path_of_the_image")
20 print(f"Predicted species: {our_big_cat}" )git clone https://github.com/smaranjitghose/Big_Cat_Classifier.gitcd Big_Cat_Classifierpip install -r requirements.txtstreamlit run app.pydocker build -t smaranjitghose/big-cat-classifier:latest .docker imagesdocker run -t -i -p 8080:8080 --name "big-cat-classifier" smaranjitghose/big-cat-classifierlocalhost:8080
ENTRYPOINT ["streamlit", "run", "app.py", "--server.port=$PORT"]heroku login -iheroku createheroku container:loginheroku container:push webheroku container:release webheroku open