Skip to content

Instantly share code, notes, and snippets.

@amankharwal
Created December 22, 2020 12:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amankharwal/084a2cb8adc19a52b00b2bfccc8ae4d8 to your computer and use it in GitHub Desktop.
Save amankharwal/084a2cb8adc19a52b00b2bfccc8ae4d8 to your computer and use it in GitHub Desktop.
img_h, img_w, num_channels = (380, 676, 3)
df = pd.read_csv('../input/car-object-detection/data/train_solution_bounding_boxes (1).csv')
df.rename(columns={'image':'image_id'}, inplace=True)
df['image_id'] = df['image_id'].apply(lambda x: x.split('.')[0])
df['x_center'] = (df['xmin'] + df['xmax'])/2
df['y_center'] = (df['ymin'] + df['ymax'])/2
df['w'] = df['xmax'] - df['xmin']
df['h'] = df['ymax'] - df['ymin']
df['classes'] = 0
df['x_center'] = df['x_center']/img_w
df['w'] = df['w']/img_w
df['y_center'] = df['y_center']/img_h
df['h'] = df['h']/img_h
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment