Last active
January 6, 2019 07:39
-
-
Save gabrielgarza/a5c36eea46f14954976fe7ab4fa4c7e3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
train_ship_segmentations_df = pd.read_csv(os.path.join("./datasets/train_val/train_ship_segmentations.csv")) | |
msk = np.random.rand(len(train_ship_segmentations_df)) < 0.8 | |
train = train_ship_segmentations_df[msk] | |
test = train_ship_segmentations_df[~msk] | |
# Move train set | |
for index, row in train.iterrows(): | |
image_id = row["ImageId"] | |
old_path = "./datasets/train_val/{}".format(image_id) | |
new_path = "./datasets/train/{}".format(image_id) | |
if os.path.isfile(old_path): | |
os.rename(old_path, new_path) | |
# Move dev set | |
for index, row in test.iterrows(): | |
image_id = row["ImageId"] | |
old_path = "./datasets/train_val/{}".format(image_id) | |
new_path = "./datasets/val/{}".format(image_id) | |
if os.path.isfile(old_path): | |
os.rename(old_path, new_path) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment