from fastai.vision import *
from fastai.metrics import error_rate
train=’/content/drive/My Drive/test2’
data = ImageDataBunch.from_folder(train, train=’.’, valid_pct=0.3,
ds_tfms=get_transforms(), size=224, num_workers=4).normalize(imagenet_stats)
from fastai.metrics import accuracy,Precision,Recall,FBeta
learn = cnn_learner(data, models.vgg16_bn, metrics=accuracy)
learn
learn.metrics=[accuracy,
Precision(average='macro'),
Recall(average='macro'),
FBeta(average='macro')]
doc(learn.fit_one_cycle)
defaults.device = torch.device(‘cuda’) # makes sure the gpu is used
learn.fit_one_cycle(4)
epoch | train_loss | valid_loss | accuracy | precision | recall | f_beta | time |
---|---|---|---|---|---|---|---|
0 | 1.193228 | 0.408133 | 0.840741 | 0.850517 | 0.840709 | 0.840866 | 02:35 |
1 | 0.816444 | 0.280234 | 0.875926 | 0.876151 | 0.876655 | 0.876534 | 00:35 |
2 | 0.685609 | 0.227305 | 0.894444 | 0.898285 | 0.895033 | 0.894569 | 00:34 |
3 | 0.570045 | 0.212675 | 0.896296 | 0.899135 | 0.896895 | 0.896825 | 00:34 |
this is my code please check it please tell me what my mistake…bcz i already try ‘weighted’ and ‘micro’ what i do so my precision and recall and F_beta are different please tell me…waiting for your reply