text_plain_output_1.png
import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)

df_train = pd.read_csv('/kaggle/input/global-wheat-detection/train.csv')

df_train.shape

df_train.shape[0] / len(df_train['image_id'].unique())

df_train.dtypes

cols_to_be_selected = ['image_id', 'x0', 'y0', 'w', 'h']
df1_train = df_train[cols_to_be_selected]

val_percentage = 0.2
num_val_images = int(len(df1_train['image_id'].unique()) * val_percentage)
num_train_images = len(df1_train['image_id'].unique()) - num_val_images
list_val_imageid = list(df1_train['image_id'].unique())[-1 * num_val_images:]
list_train_imageid = list(df1_train['image_id'].unique())[:num_train_images]

print('Number of validation images: ', num_val_images)
print('Number of training images: ', num_train_images)
print(num_val_images + num_train_images)