Kaggle competition: Cassava Leaf Disease Classification
<SOS> metric: CategorizationAccuracy Kaggle data source: cassava-leaf-disease-classification<load_from_csv>
!pip install.. /input/keras-efficientnet-whl/Keras_Applications-1.0.8-py3-none-any.whl
!pip install.. /input/keras-efficientnet-whl/efficientnet-1.1.1-py3-none-any.whl
df = pd.read_csv('.. /input/radek-whale-oversample/oversampled_train_and_val.csv' )<choose_model_class>
%matplotlib inline
print("Tensorflow version " + tf.__version__)
%%time
learn = create_cnn(data, models.resnet50, lin_ftrs=[2048], model_dir=MODEL_PATH)
 learn.load(f'{name}-stage-6' )<predict_on_test>
data = pd.read_csv(".. /input/cassava-leaf-disease-classification/train.csv" )
preds, _ = learn.get_preds(DatasetType.Test )<concatenate>
IMG_SIZE = 512
BATCH_SIZE = 18
STEPS_PER_EPOCH = len(data)*0.8/BATCH_SIZE
VALIDATION_STEPS = len(data)*0.2/BATCH_SIZE
EPOCHS = 20
preds = torch.cat(( preds, torch.ones_like(preds[:, :1])) , 1 )<feature_engineering>
model = keras.models.load_model('.. /input/notebook454e103ae7/EfficientNetB0.h5' )
preds[:, 5004] = 0.06<define_variables>
submission_file = pd.read_csv(os.path.join('.. /input/cassava-leaf-disease-classification/sample_submission.csv'))
submission_file
classes = learn.data.classes + ['new_whale']<import_modules>
preds = []
for image_id in submission_file.image_id:
image = Image.open(os.path.join(f'.. /input/cassava-leaf-disease-classification/test_images/{image_id}'))
image = image.resize(( IMG_SIZE, IMG_SIZE))
image = np.expand_dims(image, axis = 0)
 preds.append(np.argmax(model.predict(image)))
 submission_file['label'] = preds
submission_file
<save_to_csv><EOS> 
submission_file.to_csv('submission.csv', index = False )