Views
No views yet
| Class ID | Denomination |
|---|---|
| 0 | 10 Taka |
| 1 | 100 Taka |
| 2 | 1000 Taka |
| 3 | 2 Taka |
| 4 | 20 Taka |
| 5 | 200 Taka |
| 6 | 5 Taka |
| 7 | 50 Taka |
| 8 | 500 Taka |
pip install torch torchvision pillow1import torch
2from torchvision import transforms
3from PIL import Image
4
5# Load the model
6model = torch.load('model.pth')
7model.eval()
8
9# Prepare the image
10transform = transforms.Compose([
11 transforms.Resize((256, 256)),
12 transforms.CenterCrop(224),
13 transforms.ToTensor(),
14 transforms.Normalize(mean=[0.485, 0.456, 0.406],
15 std=[0.229, 0.224, 0.225])
16])
17
18# Load and preprocess image
19image = Image.open('currency.jpg').convert('RGB')
20image_tensor = transform(image).unsqueeze(0)
21
22# Make prediction
23with torch.no_grad():
24 outputs = model(image_tensor)
25 probabilities = torch.softmax(outputs, dim=1)
26 predicted_class = torch.argmax(probabilities, dim=1).item()
27 confidence = probabilities[0, predicted_class].item()
28
29# Currency mapping
30currencies = {
31 0: '10 Taka',
32 1: '100 Taka',
33 2: '1000 Taka',
34 3: '2 Taka',
35 4: '20 Taka',
36 5: '200 Taka',
37 6: '5 Taka',
38 7: '50 Taka',
39 8: '500 Taka'
40}
41
42print(f"Predicted: {currencies[predicted_class]}")
43print(f"Confidence: {confidence:.4f}")1import torch
2from transformers import AutoModel, AutoImageProcessor
3
4# Load model and processor
5model = AutoModel.from_pretrained("your-username/efficientnetb0-bangladeshi-currency")
6processor = AutoImageProcessor.from_pretrained("your-username/efficientnetb0-bangladeshi-currency")
7
8from PIL import Image
9image = Image.open('currency.jpg')
10
11# Process and predict
12inputs = processor(images=image, return_tensors="pt")
13with torch.no_grad():
14 outputs = model(**inputs)
15 logits = outputs.logits
16 predicted_label = logits.argmax(-1).item()1@misc{efficientnetb0_bangladeshi_currency,
2 title={EfficientNetB0 Bangladeshi Currency Classifier},
3 author={Your Name},
4 year={2026},
5 publisher={Hugging Face},
6 howpublished={\url{https://huggingface.co/your-username/efficientnetb0-bangladeshi-currency}}
7}