kernel_id int64 24.2k 23.3M | prompt stringlengths 8 1.85M | completetion stringlengths 1 182k | comp_name stringlengths 5 57 |
|---|---|---|---|
13,871,913 | train_data.isnull().sum()<rename_columns> | df_annotations = pd.read_csv(os.path.join(DIR, "train_annotations.csv")) | RANZCR CLiP - Catheter and Line Position Challenge |
13,871,913 | train_data = train_data.rename(columns = {"Province/State":"State" , "Country/Region":"Country" } )<count_missing_values> | row = df_annotations.iloc[8]
image_path = os.path.join(DIR, "train", row["StudyInstanceUID"] + ".jpg")
chosen_image = cv2.imread(image_path ) | RANZCR CLiP - Catheter and Line Position Challenge |
13,871,913 | train_data = train_data.fillna("Not Available")
train_data.isnull().sum()<filter> | def NeedleAugmentation(image, n_needles=2, dark_needles=False, p=0.5, needle_folder='.. /input/xray-needle-augmentation'):
aug_prob = random.random()
if aug_prob < p:
height, width, _ = image.shape
needle_images = [im for im in os.listdir(needle_folder)if 'png' in im]
for _ in range(1, n_needles):
needle = cv2.cvtColor... | RANZCR CLiP - Catheter and Line Position Challenge |
13,871,913 | train_data[train_data['ConfirmedCases']<0]<filter> | chosen_image = cv2.imread(image_path)
aug_image = NeedleAugmentation(chosen_image, n_needles=3, dark_needles=False, p=1.0)
plt.imshow(aug_image ) | RANZCR CLiP - Catheter and Line Position Challenge |
13,871,913 | train_data[train_data['Fatalities']<0]<data_type_conversions> | chosen_image = cv2.imread(image_path)
aug_image = NeedleAugmentation(chosen_image, n_needles=3, dark_needles=True, p=1.0)
plt.imshow(aug_image ) | RANZCR CLiP - Catheter and Line Position Challenge |
13,871,913 | train_data['Date'] = pd.to_datetime(train_data['Date'] )<filter> | torch_trans_list = [transforms.CenterCrop(( 178, 178)) ,
transforms.Resize(128),
transforms.RandomRotation(45),
transforms.RandomAffine(35),
transforms.RandomCrop(128),
transforms.RandomHorizontalFlip(p=1),
transforms.RandomPerspective(p=1),
transforms.RandomVerticalFlip(p=1)] | RANZCR CLiP - Catheter and Line Position Challenge |
13,871,913 | train_data[train_data['ConfirmedCases'] == train_data['ConfirmedCases'].max() ]<groupby> | INFER_MODE = 'TF' | RANZCR CLiP - Catheter and Line Position Challenge |
13,871,913 | date_country_total = train_data.groupby(['Date'] ).sum()
<groupby> | !pip install.. /input/timm-package/timm-0.1.26-py3-none-any.whl | RANZCR CLiP - Catheter and Line Position Challenge |
13,871,913 | date_country_total['Total Cases'] = date_country_total['ConfirmedCases'].cumsum()<groupby> | if INFER_MODE == 'TORCH':
sys.path.append('.. /input/pytorch-image-models/pytorch-image-models-master')
MODEL_DIR = '.. /input/ranzcr-pytorch-weights/'
OUTPUT_DIR = './'
if not os.path.exists(OUTPUT_DIR):
os.makedirs(OUTPUT_DIR)
TEST_PATH = '.. /input/ranzcr-clip-catheter-line-classification/test' | RANZCR CLiP - Catheter and Line Position Challenge |
13,871,913 | country_cases = train_data.groupby(['Country' , 'Lat' , 'Long'] ).sum()
country_cases.reset_index(inplace=True)
country_cases<data_type_conversions> | class CFG:
debug=False
num_workers=4
model_name='resnext50_32x4d'
size=600
batch_size=64
seed=42
target_size=11
target_cols=['ETT - Abnormal', 'ETT - Borderline', 'ETT - Normal',
'NGT - Abnormal', 'NGT - Borderline', 'NGT - Incompletely Imaged', 'NGT - Normal',
'CVC - Abnormal', 'CVC - Borderline', 'CVC - Normal',
'Swa... | RANZCR CLiP - Catheter and Line Position Challenge |
13,871,913 | columns = train_data.columns.tolist()
columns
train_data['Date'] = pd.to_numeric(train_data['Date'] )<prepare_x_and_y> | if INFER_MODE == 'TORCH':
Compose, OneOf, Normalize, Resize, RandomResizedCrop, RandomCrop, HorizontalFlip, VerticalFlip,
RandomBrightness, RandomContrast, RandomBrightnessContrast, Rotate, ShiftScaleRotate, Cutout,
IAAAdditiveGaussianNoise, Transpose
)
warnings.filterwarnings('ignore')
device = torch.device('cuda' ... | RANZCR CLiP - Catheter and Line Position Challenge |
13,871,913 | columns = [c for c in columns if c not in['Id','ConfirmedCases','Fatalities','State','Country']]
X_train = train_data[columns]
Y1_train = train_data['ConfirmedCases']
Y2_train = train_data['Fatalities']
print(X_train.shape)
print(Y1_train.shape)
print(Y2_train.shape )<train_model> | if INFER_MODE == 'TORCH':
model = CustomResNext(CFG.model_name, pretrained=False)
states = [torch.load(MODEL_DIR+f'needle_more_augs_10folds_pretrained_{CFG.model_name}_fold{fold}_best.pth')for fold in CFG.trn_fold]
test_dataset = TestDataset(test, transform=get_transforms(data='valid'))
test_loader = DataLoader(test_d... | RANZCR CLiP - Catheter and Line Position Challenge |
13,871,913 | regressor = RandomForestRegressor(n_estimators = 100 ,random_state=0)
regressor.fit(X_train,Y1_train)
<load_from_csv> | !pip install /kaggle/input/kerasapplications -q
!pip install /kaggle/input/efficientnet-keras-source-code/ -q --no-deps | RANZCR CLiP - Catheter and Line Position Challenge |
13,871,913 | <data_type_conversions><EOS> | if INFER_MODE == 'TF':
def auto_select_accelerator() :
try:
tpu = tf.distribute.cluster_resolver.TPUClusterResolver()
tf.config.experimental_connect_to_cluster(tpu)
tf.tpu.experimental.initialize_tpu_system(tpu)
strategy = tf.distribute.experimental.TPUStrategy(tpu)
print("Running on TPU:", tpu.master())
except Val... | RANZCR CLiP - Catheter and Line Position Challenge |
13,828,403 | <SOS> metric: MCAUC Kaggle data source: ranzcr-clip-catheter-and-line-position-challenge<data_type_conversions> | tez_path = '.. /input/tez-lib/'
effnet_path = '.. /input/efficientnet-pytorch/'
sys.path.append(tez_path)
sys.path.append(effnet_path ) | RANZCR CLiP - Catheter and Line Position Challenge |
13,828,403 | test_data['Date'] = pd.to_numeric(test_data['Date'] )<define_variables> | import os
import albumentations
import pandas as pd
import numpy as np
import tez
from tez.datasets import ImageDataset
import torch
import torch.nn as nn
from torch.nn import functional as F
from efficientnet_pytorch import EfficientNet | RANZCR CLiP - Catheter and Line Position Challenge |
13,828,403 | columnst = [c for c in columnst if c not in ['ForecastId', 'Province/State', 'Country/Region']]
columnst<predict_on_test> | INPUT_PATH = ".. /input/ranzcr-clip-catheter-line-classification/"
IMAGE_PATH = ".. /input/ranzcr-clip-catheter-line-classification/test/"
MODEL_PATH = ".. /input/ranzcr-effnet5/"
IMAGE_SIZE = 512 | RANZCR CLiP - Catheter and Line Position Challenge |
13,828,403 | y1_pred = regressor.predict(test_data[columnst] )<train_model> | df = pd.read_csv(os.path.join(INPUT_PATH, "sample_submission.csv")) | RANZCR CLiP - Catheter and Line Position Challenge |
13,828,403 | regressor.fit(X_train,Y2_train)
<predict_on_test> | class RanzcrModel(tez.Model):
def __init__(self):
super().__init__()
self.effnet = EfficientNet.from_name("efficientnet-b5")
self.effnet._conv_stem.in_channels = 1
weight = self.effnet._conv_stem.weight.mean(1, keepdim=True)
self.effnet._conv_stem.weight = torch.nn.Parameter(weight)
self.dropout = nn.Dropout(0.1)
s... | RANZCR CLiP - Catheter and Line Position Challenge |
13,828,403 | y2_pred = regressor.predict(test_data[columnst] )<load_from_csv> | test_aug = albumentations.Compose(
[
albumentations.Resize(IMAGE_SIZE, IMAGE_SIZE, p=1.0),
albumentations.HorizontalFlip(p=0.5),
albumentations.Normalize(
mean=[0.485],
std=[0.229],
max_pixel_value=255.0,
p=1.0,
),
],
p=1.0,
) | RANZCR CLiP - Catheter and Line Position Challenge |
13,828,403 | pred1 = pd.DataFrame(y1_pred)
pred2 = pd.DataFrame(y2_pred)
sub_df = pd.read_csv('.. /input/covid19-global-forecasting-week-1/submission.csv')
sub_df.head()<save_to_csv> | test_image_paths = [
os.path.join(IMAGE_PATH, x + ".jpg")
for x in df.StudyInstanceUID.values
] | RANZCR CLiP - Catheter and Line Position Challenge |
13,828,403 | datasets = pd.concat([sub_df['ForecastId'],pred1,pred2],axis=1)
datasets.columns = ['ForecastId','ConfirmedCases','Fatalities']
datasets.to_csv('submission.csv',index=False )<load_from_csv> | model = RanzcrModel()
model.load(os.path.join(MODEL_PATH, "effnet5_fold_0.bin")) | RANZCR CLiP - Catheter and Line Position Challenge |
13,828,403 | train_data = pd.read_csv("/kaggle/input/titanic/train.csv")
train_data.head(n=10)
<load_from_csv> | final_preds = None
for j in range(2):
test_dataset = ImageDataset(
image_paths=test_image_paths,
targets=[0]*len(test_image_paths),
augmentations=test_aug,
grayscale=True,
)
preds = model.predict(test_dataset, batch_size=32, n_jobs=-1, device="cuda")
temp_preds = None
for p in preds:
if temp_preds is None:
temp_pre... | RANZCR CLiP - Catheter and Line Position Challenge |
13,828,403 | test_data = pd.read_csv("/kaggle/input/titanic/test.csv")
test_data.describe()<filter> | target_cols = df.columns[1:]
for i in range(final_preds.shape[1]):
df.loc[:, target_cols[i]] = final_preds[:, i] | RANZCR CLiP - Catheter and Line Position Challenge |
13,828,403 | <create_dataframe><EOS> | df.to_csv('submission.csv', index=False)
df.head() | RANZCR CLiP - Catheter and Line Position Challenge |
17,151,036 | best_degree = pd.DataFrame()
for place in result.place.unique() :
a = result[result['place']==place]
best_degree = best_degree.append(a[a['RMSLE'] == a['RMSLE'].min() ])
print(best_degree.groupby('degree')['place'].nunique())
print('Zero polynomial(no fit): ',best_degree[best_degree['RMSLE']<0.00001]['place'].unique(... |
class CassavaDataset(Dataset):
def __init__(self, data, targets, dataset, transform=None):
self.files = data
self.targets = targets
self.classes = list(set(targets))
self.transform = transform
self.dataset = dataset
def __len__(self):
return len(self.files)
def __getitem__(self, idx):
if torch.is_tensor(idx):
idx ... | Cassava Leaf Disease Classification |
17,151,036 | fit_best_degree = best_degree[best_degree['RMSLE']>0.00001]
twodeg_places = fit_best_degree[fit_best_degree['degree']==2]['place'].unique()
threedeg_places = fit_best_degree[fit_best_degree['degree']==3]['place'].unique()
fourdeg_places = fit_best_degree[fit_best_degree['degree']==4]['place'].unique()
fivedeg_places = ... |
dfx = pd.read_csv('.. /input/cassava-leaf-disease-classification/train.csv')
df_train, df_valid = model_selection.train_test_split(dfx, test_size=0.1, random_state=42, stratify=dfx.label.values)
_train = df_train.reset_index(drop=True)
df_valid = df_valid.reset_index(drop=True)
image_path = ".. /input/cassava-lea... | Cassava Leaf Disease Classification |
17,151,036 | XYtest = XYtest.reset_index(drop=True)
XYtest['intercept'] = -1<choose_model_class> |
cassava_train = CassavaDataset(train_image_paths, train_targets, 'train')
cassava_test = CassavaDataset(valid_image_paths, valid_targets, 'test')
batch_size = 16
train_loader = DataLoader(cassava_train, batch_size=batch_size, shuffle=False, num_workers=2)
test_loader = DataLoader(cassava_test, batch_size=batch_siz... | Cassava Leaf Disease Classification |
17,151,036 | poly_predicted_confirmedcases = pd.DataFrame()
for place in twodeg_places:
features = XYtrain[XYtrain['place']==place][['label','intercept']]
target = XYtrain[XYtrain['place']==place]['ConfirmedCases']
Xtest = XYtest[XYtest['place']==place][['label','intercept']]
model = make_pipeline(PolynomialFeatures(2), Ridge())
m... |
class AverageMeter:
def __init__(self):
self.reset()
def reset(self):
self.val = 0
self.avg = 0
self.sum = 0
self.count = 0
def update(self, val, n=1):
self.val = val
self.sum += val * n
self.count += n
self.avg = self.sum / self.count
def accuracy(output, target, topk=(1,)) :
maxk = max(topk)
batch_size = targe... | Cassava Leaf Disease Classification |
17,151,036 | fatalities_result=pd.DataFrame()
for place in poly_data.place.unique() :
for degree in [2,3,4,5]:
features = XYtrain[XYtrain['place']==place][['label','intercept']]
target = XYtrain[XYtrain['place']==place]['Fatalities']
model = make_pipeline(PolynomialFeatures(degree), Ridge())
model.fit(np.array(features), target)
... |
def train_epoch(model, loader, device, loss_func, optimizer, scheduler):
model.train()
summary_loss = AverageMeter()
summary_acc = AverageMeter()
start = time.time()
n = len(loader)
for batch in tqdm(loader):
images, labels = batch
images = images.to(device)
labels = labels.to(device)
out = model(images)
loss = l... | Cassava Leaf Disease Classification |
17,151,036 | fat_best_degree = pd.DataFrame()
for place in fatalities_result.place.unique() :
a = fatalities_result[fatalities_result['place']==place]
fat_best_degree = fat_best_degree.append(a[a['RMSLE'] == a['RMSLE'].min() ])
print(fat_best_degree.groupby('degree')['place'].nunique())
print('Zero polynomial(no fit): ',
fat_best... |
resnet = timm.create_model('resnext50_32x4d', pretrained=True)
num_ftrs = resnet.fc.in_features
resnet.fc = nn.Linear(num_ftrs, 5)
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
resnet.to(device ) | Cassava Leaf Disease Classification |
17,151,036 | fit_best_degree = fat_best_degree[fat_best_degree['RMSLE']>0.000001]
twodeg_places = fit_best_degree[fit_best_degree['degree']==2]['place'].unique()
threedeg_places = fit_best_degree[fit_best_degree['degree']==3]['place'].unique()
fourdeg_places = fit_best_degree[fit_best_degree['degree']==4]['place'].unique()
fivedeg_... |
num_epochs = 1
best_acc = 0
best_epoch = 0
criterion = nn.CrossEntropyLoss()
optimizer = optim.SGD(resnet.parameters() , lr=0.01, momentum=0.9)
scheduler = ReduceLROnPlateau(optimizer, mode='min', factor=0.2, patience=2, verbose=True, eps=1e-6)
for epoch in range(num_epochs):
print('Epoch {}/{}'.format(epoch + 1, n... | Cassava Leaf Disease Classification |
17,151,036 | poly_predicted_fatalities = pd.DataFrame()
for place in twodeg_places:
features = XYtrain[XYtrain['place']==place][['label','intercept']]
target = XYtrain[XYtrain['place']==place]['Fatalities']
Xtest = XYtest[XYtest['place']==place][['label','intercept']]
model = make_pipeline(PolynomialFeatures(2), Ridge())
model.fit... |
num_epochs = 10
best_acc = 0
best_epoch = 0
criterion = nn.CrossEntropyLoss()
optimizer = optim.SGD(xception.parameters() , lr=0.01, momentum=0.9)
scheduler = ReduceLROnPlateau(optimizer, mode='min', factor=0.2, patience=2, verbose=True, eps=1e-6)
for epoch in range(num_epochs):
print('Epoch {}/{}'.format(epoch + 1... | Cassava Leaf Disease Classification |
17,151,036 | for place in nofit_places1:
e = poly_data[(poly_data['place']==place)&(poly_data['date']>'2020-03-11')]
f = e['ConfirmedCases'].fillna(method = 'ffill')
g = pd.DataFrame(zip(e['place'], f),columns=['place','ConfirmedCases'])
poly_predicted_confirmedcases = poly_predicted_confirmedcases.append(g)
for place in nofit_p... |
PATH = './timm_resnext_epoch10_384.pth'
resnet = timm.create_model('resnext50_32x4d', pretrained=False)
num_ftrs = resnet.fc.in_features
resnet.fc = nn.Linear(num_ftrs, 5)
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
resnet.to(device)
resnet.load_state_dict(torch.load(PATH))
resnet.eval... | Cassava Leaf Disease Classification |
17,151,036 | poly_predicted_confirmedcases2= pd.DataFrame({'date':XYtest.date,
'place':poly_predicted_confirmedcases['place'].tolist() ,
'ConfirmedCases':poly_predicted_confirmedcases['ConfirmedCases'].tolist() })
poly_predicted_confirmedcases2.head()<prepare_output> |
submission_df = pd.read_csv('.. /input/cassava-leaf-disease-classification/sample_submission.csv')
submission_df.head() | Cassava Leaf Disease Classification |
17,151,036 | poly_predicted_fatalities2= pd.DataFrame({'date':XYtest.date,
'place':poly_predicted_fatalities['place'].tolist() ,
'Fatalities':poly_predicted_fatalities['Fatalities'].tolist() })
poly_predicted_fatalities2.head()<merge> |
input_size = 384
stats =([0.4914, 0.4822, 0.4465], [0.247, 0.243, 0.261])
trans1 = transforms.Compose([transforms.Resize(( input_size, input_size)) ,
transforms.Pad(8, padding_mode='reflect'),
transforms.ToTensor() ,
transforms.Normalize(*stats)])
trans2 = transforms.Compose([transforms.Resize(( input_size, input_s... | Cassava Leaf Disease Classification |
17,151,036 | poly_compiled = poly_predicted_confirmedcases2.merge(poly_predicted_fatalities2, how='inner', on=['place','date'] )<merge> |
test_path = '/kaggle/input/cassava-leaf-disease-classification/test_images/'
test_images = os.listdir(test_path)
train_image_paths = [os.path.join(test_path, x)for x in test_images]
y_preds = []
y2_preds = []
p = 0
for i in test_images:
res = []
image = Image.open(f'/kaggle/input/cassava-leaf-disease-classification/... | Cassava Leaf Disease Classification |
17,151,036 | test_poly_compiled= test.merge(poly_compiled, how='inner', on=['place','date'])
test_poly_compiled<load_from_csv> | df_sub = pd.DataFrame({'image_id': test_images, 'label': y_preds})
display(df_sub ) | Cassava Leaf Disease Classification |
17,151,036 | <merge><EOS> | df_sub.to_csv('submission.csv', index=False ) | Cassava Leaf Disease Classification |
13,592,835 | <SOS> metric: CategorizationAccuracy Kaggle data source: cassava-leaf-disease-classification<feature_engineering> | !pip install --quiet /kaggle/input/kerasapplications
!pip install --quiet /kaggle/input/efficientnet-git | Cassava Leaf Disease Classification |
13,592,835 | sub2['ConfirmedCases'] = sub2['ConfirmedCases'].round(0)
sub2['Fatalities'] = sub2['Fatalities'].round(0 ).abs()<save_to_csv> | def seed_everything(seed=0):
random.seed(seed)
np.random.seed(seed)
tf.random.set_seed(seed)
os.environ['PYTHONHASHSEED'] = str(seed)
os.environ['TF_DETERMINISTIC_OPS'] = '1'
seed = 0
seed_everything(seed)
warnings.filterwarnings('ignore' ) | Cassava Leaf Disease Classification |
13,592,835 | sub2.to_csv('submission.csv', index=False )<define_variables> | BATCH_SIZE = 16 * REPLICAS
HEIGHT = 512
WIDTH = 512
CHANNELS = 3
N_CLASSES = 5
TTA_STEPS = 5 | Cassava Leaf Disease Classification |
13,592,835 |
<count_unique_values> | def data_augment(image, label):
p_spatial = tf.random.uniform([], 0, 1.0, dtype=tf.float32)
p_rotate = tf.random.uniform([], 0, 1.0, dtype=tf.float32)
p_pixel_1 = tf.random.uniform([], 0, 1.0, dtype=tf.float32)
p_pixel_2 = tf.random.uniform([], 0, 1.0, dtype=tf.float32)
p_crop = tf.random.uniform([], 0, 1.0, dtype=... | Cassava Leaf Disease Classification |
13,592,835 |
<sort_values> | def transform_rotation(image, height, rotation):
DIM = height
XDIM = DIM%2
rotation = rotation * tf.random.uniform([1],dtype='float32')
rotation = math.pi * rotation / 180.
c1 = tf.math.cos(rotation)
s1 = tf.math.sin(rotation)
one = tf.constant([1],dtype='float32')
zero = tf.constant([0],dtype='float32')
rotation... | Cassava Leaf Disease Classification |
13,592,835 |
<drop_column> | def model_fn(input_shape, N_CLASSES):
inputs = L.Input(shape=input_shape, name='input_image')
base_model = efn.EfficientNetB4(input_tensor=inputs,
include_top=False,
weights=None,
pooling='avg')
x = L.Dropout (.5 )(base_model.output)
output = L.Dense(N_CLASSES, activation='softmax', name='output' )(x)
model = Model... | Cassava Leaf Disease Classification |
13,592,835 |
<define_variables> | files_path = f'{database_base_path}test_images/'
test_size = len(os.listdir(files_path))
test_preds = np.zeros(( test_size, N_CLASSES))
for model_path in model_path_list:
print(model_path)
K.clear_session()
model.load_weights(model_path)
if TTA_STEPS > 0:
test_ds = get_dataset(files_path, tta=True ).repeat()
ct_steps... | Cassava Leaf Disease Classification |
13,592,835 | <load_from_csv><EOS> | submission = pd.DataFrame({'image_id': image_names, 'label': test_preds})
submission.to_csv('submission.csv', index=False)
display(submission.head() ) | Cassava Leaf Disease Classification |
13,936,057 | <SOS> metric: CategorizationAccuracy Kaggle data source: cassava-leaf-disease-classification<create_dataframe> | tez_path = '.. /input/tez-lib/'
effnet_path = '.. /input/efficientnet-pytorch/'
sys.path.append(tez_path)
sys.path.append(effnet_path)
| Cassava Leaf Disease Classification |
13,936,057 | client = bigquery.Client()
dataset_ref = client.dataset("noaa_gsod", project="bigquery-public-data")
dataset = client.get_dataset(dataset_ref)
tables = list(client.list_tables(dataset))
table_ref = dataset_ref.table("stations")
table = client.get_table(table_ref)
stations_df = client.list_rows(table ).to_dataframe(... | class LeafModel(tez.Model):
def __init__(self, num_classes):
super().__init__()
self.effnet = EfficientNet.from_name("efficientnet-b4")
self.dropout = nn.Dropout(0.1)
self.out = nn.Linear(1792, num_classes)
self.step_scheduler_after = "epoch"
def forward(self, image, targets=None):
batch_size, _, _, _ = image.shape
... | Cassava Leaf Disease Classification |
13,936,057 | weather_df['day_from_jan_first'] =(weather_df['da'].apply(int)
+ 31*(weather_df['mo']=='02')
+ 60*(weather_df['mo']=='03')
+ 91*(weather_df['mo']=='04')
)
mo = train['Date'].apply(lambda x: x[5:7])
da = train['Date'].apply(lambda x: x[8:10])
train['day_from_jan_first'] =(da.apply(int)
+ 31*(mo=='02')
+ 60*(mo==... | test_aug = albumentations.Compose([
albumentations.RandomResizedCrop(256, 256),
albumentations.Transpose(p=0.5),
albumentations.HorizontalFlip(p=0.5),
albumentations.VerticalFlip(p=0.5),
albumentations.HueSaturationValue(
hue_shift_limit=0.2,
sat_shift_limit=0.2,
val_shift_limit=0.2,
p=0.5
),
albumentations.RandomBri... | Cassava Leaf Disease Classification |
13,936,057 | test = pd.read_csv("/kaggle/input/covid19-global-forecasting-week-1/test.csv" )<feature_engineering> | dfx = pd.read_csv(".. /input/cassava-leaf-disease-classification/sample_submission.csv")
image_path = ".. /input/cassava-leaf-disease-classification/test_images/"
test_image_paths = [os.path.join(image_path, x)for x in dfx.image_id.values]
test_targets = dfx.label.values
test_dataset = ImageDataset(
image_paths=test_... | Cassava Leaf Disease Classification |
13,936,057 | weather_df['day_from_jan_first'] =(weather_df['da'].apply(int)
+ 31*(weather_df['mo']=='02')
+ 60*(weather_df['mo']=='03')
+ 91*(weather_df['mo']=='04')
)
mo = test['Date'].apply(lambda x: x[5:7])
da = test['Date'].apply(lambda x: x[8:10])
test['day_from_jan_first'] =(da.apply(int)
+ 31*(mo=='02')
+ 60*(mo=='03... | train_dfx = pd.read_csv(".. /input/cassava-leaf-disease-classification/train.csv")
model = LeafModel(num_classes=train_dfx.label.nunique())
model.load(".. /input/leafmodel/model.bin")
| Cassava Leaf Disease Classification |
13,936,057 | train["wdsp"] = pd.to_numeric(train["wdsp"])
test["wdsp"] = pd.to_numeric(test["wdsp"])
train["fog"] = pd.to_numeric(train["fog"])
test["fog"] = pd.to_numeric(test["fog"] )<drop_column> | final_preds = None
for j in range(20):
preds = model.predict(test_dataset, batch_size=32, n_jobs=-1, device="cuda")
temp_preds = None
for p in preds:
if temp_preds is None:
temp_preds = p
else:
temp_preds = np.vstack(( temp_preds, p))
if final_preds is None:
final_preds = temp_preds
else:
final_preds += temp_preds
fin... | Cassava Leaf Disease Classification |
13,936,057 | <data_type_conversions><EOS> | final_preds = final_preds.argmax(axis=1)
dfx.label = final_preds
dfx.to_csv("submission.csv", index=False ) | Cassava Leaf Disease Classification |
14,771,514 | <SOS> metric: CategorizationAccuracy Kaggle data source: cassava-leaf-disease-classification<rename_columns> | ! pip install.. /input/mlcollection/ml_collections-0.1.0-py3-none-any.whl | Cassava Leaf Disease Classification |
14,771,514 | X_train = X_train.set_index(['Date'])
X_test = X_test.set_index(['Date'] )<feature_engineering> | from glob import glob
from sklearn.model_selection import GroupKFold, StratifiedKFold
import cv2
from skimage import io
import torch
from torch import nn
import os
from datetime import datetime
import time
import random
import cv2
import torchvision
from torchvision import transforms
import pandas as pd
import numpy as... | Cassava Leaf Disease Classification |
14,771,514 | def create_time_features(df):
df['date'] = df.index
df['hour'] = df['date'].dt.hour
df['dayofweek'] = df['date'].dt.dayofweek
df['quarter'] = df['date'].dt.quarter
df['month'] = df['date'].dt.month
df['year'] = df['date'].dt.year
df['dayofyear'] = df['date'].dt.dayofyear
df['dayofmonth'] = df['date'].dt.day
df['weeko... | CFG = {
'fold_num': 5,
'seed': 719,
'model_arch': 'resnext101_ibn_a',
'model_arch_eff':'tf_efficientnet_b4_ns',
'img_size': 512,
'epochs': 10,
'train_bs': 32,
'valid_bs': 32,
'lr': 1e-4,
'num_workers': 4,
'accum_iter': 1,
'verbose_step': 1,
'device': 'cuda' if torch.cuda.is_available() else 'cpu',
'tta': 4,
}
ckpt_path... | Cassava Leaf Disease Classification |
14,771,514 | create_time_features(X_train)
create_time_features(X_test )<drop_column> | train = pd.read_csv('.. /input/cassava-leaf-disease-classification/train.csv')
train.head() | Cassava Leaf Disease Classification |
14,771,514 | X_train.drop("date", axis=1, inplace=True)
X_test.drop("date", axis=1, inplace=True )<categorify> | train.label.value_counts() | Cassava Leaf Disease Classification |
14,771,514 | X_train = pd.concat([X_train,pd.get_dummies(X_train['Province/State'], prefix='ps')],axis=1)
X_train.drop(['Province/State'],axis=1, inplace=True)
X_test = pd.concat([X_test,pd.get_dummies(X_test['Province/State'], prefix='ps')],axis=1)
X_test.drop(['Province/State'],axis=1, inplace=True)
X_train = pd.concat([X_tra... | submission = pd.read_csv('.. /input/cassava-leaf-disease-classification/sample_submission.csv')
submission.head() | Cassava Leaf Disease Classification |
14,771,514 | Y1= train["ConfirmedCases"]<prepare_x_and_y> | class CassavaDataset(Dataset):
def __init__(
self, df, data_root, transforms=None, output_label=True
):
super().__init__()
self.df = df.reset_index(drop=True ).copy()
self.transforms = transforms
self.data_root = data_root
self.output_label = output_label
def __len__(self):
return self.df.shape[0]
def __getitem__(sel... | Cassava Leaf Disease Classification |
14,771,514 | Y2 = train["Fatalities"]<train_model> | HorizontalFlip, VerticalFlip, IAAPerspective, ShiftScaleRotate, CLAHE, RandomRotate90,
Transpose, ShiftScaleRotate, Blur, OpticalDistortion, GridDistortion, HueSaturationValue,
IAAAdditiveGaussianNoise, GaussNoise, MotionBlur, MedianBlur, IAAPiecewiseAffine, RandomResizedCrop,
IAASharpen, IAAEmboss, RandomBrightnessCon... | Cassava Leaf Disease Classification |
14,771,514 | model = RandomForestClassifier(bootstrap=True,max_depth=None, max_features='auto', max_leaf_nodes=None,
n_estimators=150, random_state=None, n_jobs=1, verbose=0)
model.fit(X_train,Y1)
pred1 = model.predict(X_test)
pred1 = pd.DataFrame(pred1)
pred1.columns = ["ConfirmedCases_prediction"]<train_model> | class CassvaImgClassifier(nn.Module):
def __init__(self, model_arch, n_class, pretrained=False):
super().__init__()
self.model = timm.create_model(model_arch, pretrained=pretrained)
n_features = self.model.classifier.in_features
self.model.classifier = nn.Linear(n_features, n_class)
def forward(self, x):
x = self.mod... | Cassava Leaf Disease Classification |
14,771,514 | model = RandomForestClassifier(bootstrap=True,max_depth=None, max_features='auto', max_leaf_nodes=None,
n_estimators=150, random_state=None, n_jobs=1, verbose=0)
model.fit(X_train,Y2)
pred2 = model.predict(X_test)
pred2 = pd.DataFrame(pred2)
pred2.columns = ["Death_prediction"]<load_from_csv> | class IBNResnextCassava(nn.Module):
def __init__(self, arch='resnext101_ibn_a', n_class=5, pre=False):
super().__init__()
m = resnext101_ibn_a()
self.enc = nn.Sequential(*list(m.children())[:-2])
nc = list(m.children())[-1].in_features
self.head = nn.Sequential(
nn.AdaptiveAvgPool2d(1),
nn.Flatten() ,
nn.Linear(2048,... | Cassava Leaf Disease Classification |
14,771,514 | data_submission = pd.read_csv("/kaggle/input/covid19-global-forecasting-week-1/submission.csv")
data_submission.columns
sub_new = data_submission[["ForecastId"]]<concatenate> | class MishFunction(torch.autograd.Function):
@staticmethod
def forward(ctx, x):
ctx.save_for_backward(x)
return x * torch.tanh(F.softplus(x))
@staticmethod
def backward(ctx, grad_output):
x = ctx.saved_variables[0]
sigmoid = torch.sigmoid(x)
tanh_sp = torch.tanh(F.softplus(x))
return grad_output *(tanh_sp + x * sigmo... | Cassava Leaf Disease Classification |
14,771,514 | concat = pd.concat([pred1,pred2,sub_new],axis=1)
concat.head()
concat.columns = ['ConfirmedCases', 'Fatalities', 'ForecastId']
concat = concat[['ForecastId','ConfirmedCases', 'Fatalities']]<data_type_conversions> | semi_weakly_supervised_model_urls = {
'resnet18': 'https://dl.fbaipublicfiles.com/semiweaksupervision/model_files/semi_weakly_supervised_resnet18-118f1556.pth',
'resnet50': 'https://dl.fbaipublicfiles.com/semiweaksupervision/model_files/semi_weakly_supervised_resnet50-16a12f1b.pth',
'resnext50_32x4d': 'https://dl.fbaip... | Cassava Leaf Disease Classification |
14,771,514 | concat["ConfirmedCases"] = concat["ConfirmedCases"].astype(int)
concat["Fatalities"] = concat["Fatalities"].astype(int )<save_to_csv> | class CassvaImgClassifier(nn.Module):
def __init__(self, model_arch, n_class, pretrained=False):
super().__init__()
self.model = create_model(model_arch, pretrained=pretrained)
n_features = self.model.classifier.in_features
self.model.classifier = nn.Linear(n_features, n_class)
def forward(self, x):
x = self.model(x)... | Cassava Leaf Disease Classification |
14,771,514 | concat.to_csv("submission.csv",index=False )<load_from_csv> | ! pip install.. /input/mlcollection/ml_collections-0.1.0-py3-none-any.whl | Cassava Leaf Disease Classification |
14,771,514 | train_df = pd.read_csv("/kaggle/input/covid19-global-forecasting-week-1/train.csv")
submission_df = pd.read_csv("/kaggle/input/covid19-global-forecasting-week-1/submission.csv")
test_df = pd.read_csv('/kaggle/input/covid19-global-forecasting-week-1/test.csv' )<data_type_conversions> | class AdaptiveConcatPool2d(nn.Module):
"Layer that concats `AdaptiveAvgPool2d` and `AdaptiveMaxPool2d`"
def __init__(self, size=None):
super().__init__()
self.size = size or 1
self.ap = nn.AdaptiveAvgPool2d(self.size)
self.mp = nn.AdaptiveMaxPool2d(self.size)
def forward(self, x): return torch.cat([self.mp(x), self.a... | Cassava Leaf Disease Classification |
14,771,514 | train_df["Date"] = train_df["Date"].apply(lambda x: datetime.strptime(x,'%Y-%m-%d'))
train_df["Date"] = train_df["Date"].apply(lambda x: x.timestamp())
train_df["Date"] = train_df["Date"].astype(int )<count_missing_values> | if __name__ == '__main__':
VALID = False
test_num = len(os.listdir('.. /input/cassava-leaf-disease-classification/test_images'))
print('test_num:', test_num)
seed_everything(CFG['seed'])
folds = StratifiedKFold(n_splits=CFG['fold_num'], shuffle=True, random_state=CFG['seed'] ).split(np.arange(train.shape[0]), train.l... | Cassava Leaf Disease Classification |
14,771,514 | train_df.isnull().sum()<drop_column> | test['label'] = np.argmax(tst_preds, axis=1)
test.head() | Cassava Leaf Disease Classification |
14,771,514 | <count_missing_values><EOS> | test.to_csv('submission.csv', index=False ) | Cassava Leaf Disease Classification |
14,754,145 | <SOS> metric: CategorizationAccuracy Kaggle data source: cassava-leaf-disease-classification<data_type_conversions> | !pip install -q '/kaggle/input/birdcall-identification-submission-custom/Keras_Applications-1.0.8-py3-none-any.whl'
!pip install -q '/kaggle/input/birdcall-identification-submission-custom/efficientnet-1.1.0-py3-none-any.whl' | Cassava Leaf Disease Classification |
14,754,145 | test_df["Date"] = test_df["Date"].apply(lambda x: datetime.strptime(x,'%Y-%m-%d'))
test_df["Date"] = test_df["Date"].apply(lambda x: x.timestamp())
test_df["Date"] = test_df["Date"].astype(int)
test_df = test_df.drop(['Province/State'],axis=1)
test_df = test_df.dropna()
test_df.head()<prepare_x_and_y> | import numpy as np
import pandas as pd
import tensorflow as tf
import efficientnet.tfkeras as efn
import matplotlib.pyplot as plt
from tqdm.notebook import tqdm | Cassava Leaf Disease Classification |
14,754,145 | X = train_df[['Lat', 'Long', 'Date']]
Y1 = train_df[['ConfirmedCases']]
X_test = test_df[['Lat', 'Long', 'Date']]
Y2 = train_df[['Fatalities']]<prepare_output> | IMG_HEIGHT = 600
IMG_WIDTH = 800
IMG_SIZE = 600
IMG_TARGET_SIZE = 512
N_CHANNELS = 3
N_LABELS = 5
N_FOLDS = 5
BATCH_SIZE = 16
AUTO = tf.data.experimental.AUTOTUNE
IMAGENET_MEAN = tf.constant([0.485, 0.456, 0.406], dtype=tf.float32)
IMAGENET_STD = tf.constant([0.229, 0.224, 0.225], dtype=tf.float32 ) | Cassava Leaf Disease Classification |
14,754,145 | rf = RandomForestRegressor(n_estimators=100)
rf.fit(X,Y1)
pred1 = rf.predict(X_test)
pred1 = pd.DataFrame(pred1)
pred1.columns = ["ConfirmedCases_prediction"]
<prepare_output> | def get_model(fold):
tf.keras.backend.clear_session()
net = efn.EfficientNetB4(
include_top=False,
weights=None,
input_shape=(IMG_TARGET_SIZE, IMG_TARGET_SIZE, N_CHANNELS),
)
for layer in reversed(net.layers):
if isinstance(layer, tf.keras.layers.BatchNormalization):
layer.trainable = False
else:
layer.trainable = T... | Cassava Leaf Disease Classification |
14,754,145 | rf_fatalities_model = RandomForestRegressor(n_estimators=100)
rf_fatalities_model.fit(X,Y2)
pred2 = rf_fatalities_model.predict(X_test)
pred2 = pd.DataFrame(pred2)
pred2.columns = ["Death_prediction"]<load_from_csv> | @tf.function
def decode_tfrecord_test(file_path):
image = tf.io.read_file(file_path)
image = tf.io.decode_jpeg(image)
image = tf.reshape(image, [IMG_HEIGHT, IMG_WIDTH, N_CHANNELS])
image = tf.cast(image, tf.float32)
image_id = tf.strings.split(file_path, '/')[-1]
return image, image_id | Cassava Leaf Disease Classification |
14,754,145 | submission = pd.read_csv("/kaggle/input/covid19-global-forecasting-week-1/submission.csv")
submission.columns
sub = submission[["ForecastId"]]<concatenate> | def get_test_dataset() :
ignore_order = tf.data.Options()
ignore_order.experimental_deterministic = False
test_dataset = tf.data.Dataset.list_files('/kaggle/input/cassava-leaf-disease-classification/test_images/*.jpg')
test_dataset = test_dataset.with_options(ignore_order)
test_dataset = test_dataset.map(decode_tfrec... | Cassava Leaf Disease Classification |
14,754,145 | combined_preds = pd.concat([pred1,pred2,sub],axis=1)
combined_preds.head()
combined_preds.columns = ['ConfirmedCases', 'Fatalities', 'ForecastId']
combined_preds = combined_preds[['ForecastId','ConfirmedCases', 'Fatalities']]<data_type_conversions> | def show_first_test_batch() :
imgs, imgs_ids = next(iter(get_test_dataset()))
img = imgs[0].numpy().astype(np.float32)
print(f'imgs.shape: {imgs.shape}, imgs.dtype: {imgs.dtype}, imgs_ids.shape: {imgs_ids.shape}, imgs_ids.dtype: {imgs_ids.dtype}')
print('img mean: {:.3f}, img std {:.3f}, img min: {:.3f}, img max: {:.... | Cassava Leaf Disease Classification |
14,754,145 | <save_to_csv><EOS> | submission = pd.DataFrame(columns=['image_id', 'label'])
preds_dict = dict()
for fold in range(N_FOLDS):
model = get_model(fold)
for idx,(imgs, image_ids)in tqdm(enumerate(get_test_dataset())) :
for img, image_id in zip(imgs, image_ids.numpy().astype(str)) :
pred = predict_tta(model, img)
if image_id in preds_dict:
... | Cassava Leaf Disease Classification |
14,743,221 | <SOS> metric: CategorizationAccuracy Kaggle data source: cassava-leaf-disease-classification<import_modules> | import numpy as np
import pandas as pd
import os
| Cassava Leaf Disease Classification |
14,743,221 | from sklearn.model_selection import train_test_split
import random
from sklearn.impute import SimpleImputer
from sklearn.pipeline import Pipeline
from sklearn.preprocessing import OneHotEncoder
from sklearn.compose import ColumnTransformer
from sklearn.ensemble import RandomForestRegressor
from sklearn.model_selection ... | !pip install timm --no-index --find-links=file:///kaggle/input/timm-package/ | Cassava Leaf Disease Classification |
14,743,221 | import datetime<choose_model_class> | !pip install albumentations --no-index --find-links=file:///kaggle/input/albumentationspackage/ | Cassava Leaf Disease Classification |
14,743,221 | def model() :
rf = RandomForestRegressor(random_state = 42,bootstrap = False, max_depth= 80, max_features = 2,
min_samples_leaf = 5, min_samples_split = 8, n_estimators = 100)
return rf<train_model> | import sys
import torch
import torch.nn.functional as F
import torch.nn as nn
from torch.nn import Parameter
import os
import cv2
import timm | Cassava Leaf Disease Classification |
14,743,221 | def train_and_predict(X, y, X_test):
rf_classifier = model()
rf_classifier_model = Pipeline(steps=[
('model', rf_classifier)
])
rf_classifier_model.fit(X, y)
y_pred = rf_classifier_model.predict(X_test)
y_pred = np.around(y_pred)
y_pred = y_pred.astype(int)
return y_pred<load_from_csv> | import albumentations as A | Cassava Leaf Disease Classification |
14,743,221 | if __name__ == '__main__':
seed = 123
random.seed(seed)
print('Loading Training Data')
covid_train = pd.read_csv("/kaggle/input/covid19-global-forecasting-week-1/train.csv",
parse_dates=['Date'])
covid_train = covid_train.drop(['Province/State'], axis=1)
covid_train = covid_train.drop(['Country/Region'], axis=1)
c... | def gem(x, p=3, eps=1e-5):
return F.avg_pool2d(x.clamp(min=eps ).pow(p),(x.size(-2), x.size(-1)) ).pow(1./p)
class GeM(nn.Module):
def __init__(self, p=3, eps=1e-5):
super(GeM, self ).__init__()
self.p = Parameter(torch.ones(1)* p)
self.eps = eps
def forward(self, x):
return gem(x, p=self.p, eps=self.eps)
def __repr... | Cassava Leaf Disease Classification |
14,743,221 | covid_train['Date'] =(pd.to_datetime(covid_train['Date'], unit='s' ).astype(int)/10**9 ).astype(int )<feature_engineering> | class Net(nn.Module):
def __init__(self, num_classes=5):
super().__init__()
self.model = timm.create_model('seresnext50_32x4d', pretrained=False)
self._avg_pooling = nn.AdaptiveAvgPool2d(1)
self.dropout=nn.Dropout(0.5)
self._fc = nn.Linear(2048 , num_classes, bias=True)
def forward(self, inputs):
input_iid = inputs... | Cassava Leaf Disease Classification |
14,743,221 | for i in range(len(covid_train['Date'])) :
covid_train['Date'][i] = covid_train['Date'][i].strftime("%d %B, %Y" )<feature_engineering> | class DatasetTest() :
def __init__(self, test_data_dir):
self.ds = self.get_list(test_data_dir)
self.root_dir = test_data_dir
self.val_trans=A.Compose([A.HorizontalFlip(p=0.5),
A.VerticalFlip(p=0.5),
A.ColorJitter(brightness=0.1, contrast=0.2, saturation=0.2, hue=0.00, always_apply=False, p=1.0),
A.RandomCrop(height= ... | Cassava Leaf Disease Classification |
14,743,221 | covid_train['Date'] = str(covid_train['Date'] )<load_from_csv> | device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
kaggle_root = '/kaggle/input'
model_dir = os.path.join(kaggle_root, 'cassva-models-se50-640')
weights = [os.path.join(model_dir, f)for f in os.listdir(model_dir)]
test_datadir= os.path.join(kaggle_root, 'cassava-leaf-disease-classification/test_ima... | Cassava Leaf Disease Classification |
14,660,386 | covid_train = pd.read_csv("/kaggle/input/covid19-global-forecasting-week-1/train.csv",
parse_dates=['Date'] )<data_type_conversions> | package_path = '.. /input/pytorch-image-models/pytorch-image-models-master'
sys.path.append(package_path ) | Cassava Leaf Disease Classification |
14,660,386 | covid_train['Date'].astype(int)/ 10**15<install_modules> | warnings.filterwarnings("ignore")
| Cassava Leaf Disease Classification |
14,660,386 | !pip install seaborn==0.11.0<import_modules> | CFG = {
'fold_num': 5,
'seed': 719,
'model_arch': 'tf_efficientnet_b4_ns',
'img_size': 512,
'epochs': 10,
'train_bs': 32,
'valid_bs': 32,
'lr': 1e-4,
'num_workers': 4,
'accum_iter': 1,
'verbose_step': 1,
'device': 'cuda:0',
'tta': 3,
'used_epochs': [6,7,8,9],
'weights': [1,1,1,1]
} | Cassava Leaf Disease Classification |
14,660,386 | pd.options.display.max_rows=200
pd.set_option('mode.chained_assignment', None)
simplefilter("ignore", category=ConvergenceWarning)
simplefilter("ignore", category=RuntimeWarning)
sns.__version__<load_from_csv> | train = pd.read_csv('.. /input/cassava-leaf-disease-classification/train.csv')
train.head(10 ) | Cassava Leaf Disease Classification |
14,660,386 | train = pd.read_csv('/kaggle/input/titanic/train.csv', index_col='PassengerId')
test = pd.read_csv('/kaggle/input/titanic/test.csv', index_col='PassengerId' )<count_missing_values> | train.label.value_counts() | Cassava Leaf Disease Classification |
14,660,386 | train.isna().sum()<count_missing_values> | submission = pd.read_csv('.. /input/cassava-leaf-disease-classification/sample_submission.csv')
submission.head() | Cassava Leaf Disease Classification |
14,660,386 | test.isna().sum()<categorify> | def seeder(seed):
random.seed(seed)
os.environ['PYTHONHASHSEED'] = str(seed)
np.random.seed(seed)
torch.manual_seed(seed)
torch.cuda.manual_seed(seed)
torch.backends.cudnn.deterministic = True
torch.backends.cudnn.benchmark = True
def get_img(path):
im_bgr = cv2.imread(path)
im_rgb = im_bgr[:, :, ::-1]
return im_... | Cassava Leaf Disease Classification |
14,660,386 | def imputer(df):
age_impute_series = df.groupby(['Pclass', 'Sex'] ).Age.transform('mean')
df.Age.fillna(age_impute_series, inplace=True)
df.Cabin = df.Cabin.str.extract(pat='([A-Z])')
df.Cabin.fillna('M', inplace=True)
df['Deck'] = df.Cabin.replace({'A':'ABC', 'B':'ABC', 'C':'ABC', 'D':'DE', 'E':'DE', 'F':'FG',
'G'... | img = get_img('.. /input/cassava-leaf-disease-classification/train_images/1000015157.jpg')
plt.figure(figsize=(15,15))
plt.imshow(img)
plt.show() | Cassava Leaf Disease Classification |
14,660,386 | train_imputed = imputer(train.copy())
test_imputed = imputer(test.copy() )<categorify> | class CassavaDataset(Dataset):
def __init__(self,df,data_root,transforms=None,output_label=True):
super(CassavaDataset ).__init__()
self.df=df.reset_index().copy()
self.data_root=data_root
self.transforms=transforms
self.output_label=output_label
def __len__(self):
return self.df.shape[0]
def __getitem__(self,index:int... | Cassava Leaf Disease Classification |
14,660,386 | def ticket_extractor(ticket):
alpha = re.sub('\d', '', ticket)
if alpha:
return alpha
else:
num = re.search('\d{1,9}', ticket)
return ticket
temp = train_imputed.copy()
temp['Ticket_extracted'] = temp.Ticket.apply(ticket_extractor)
for i in range(len(temp.Ticket)) :
try:
int(temp.Ticket_extracted.iloc[i])
temp.Tick... | HorizontalFlip, VerticalFlip, IAAPerspective, ShiftScaleRotate, CLAHE, RandomRotate90,
Transpose, ShiftScaleRotate, Blur, OpticalDistortion, GridDistortion, HueSaturationValue,
IAAAdditiveGaussianNoise, GaussNoise, MotionBlur, MedianBlur, IAAPiecewiseAffine, RandomResizedCrop,
IAASharpen, IAAEmboss, RandomBrightnessCon... | Cassava Leaf Disease Classification |
14,660,386 | temp = train_imputed.copy()
temp['Title'] = temp.Name.str.extract(pat='([a-zA-Z]+\.) ')
temp.Title[~temp.Title.isin(['Mr.', 'Miss.', 'Mrs.', 'Master.'])] = 'rare'<categorify> | class CassvaImgClassifier(nn.Module):
def __init__(self, model_arch, n_class, pretrained=False):
super().__init__()
self.model = timm.create_model(model_arch, pretrained=pretrained)
n_features = self.model.classifier.in_features
self.model.classifier = nn.Linear(n_features, n_class)
def forward(self, x):
x = self.mod... | Cassava Leaf Disease Classification |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.