You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
``I am reproducing the result.
For the SAM dataset download, I found this link: SAM
The dataset config file in this repo shows that it is divided into 4 subset. However, the original SAM dataset did not do that. Instead, it is just .jpg and .json file in the root folder.
Therefore, I am wondering if I should write a script to split the dataset into 4 subsets.
Here is my current code for doing that:
importosimportshutilsource_dir='SAM'folders= ['0000', '0001', '0002', '0003']
forfolderinfolders:
os.makedirs(os.path.join(source_dir, folder), exist_ok=True)
total_pairs=11187pairs_per_folder=total_pairs//4extra_pairs=total_pairs%4# This will be 3 in this casefolder_indices= [0, 1, 2, 3]
folder_counts= [pairs_per_folder] *4foriinrange(extra_pairs):
folder_counts[i] +=1cumulative_counts= [sum(folder_counts[:i+1]) foriinrange(len(folder_counts))]
foriinrange(1, total_pairs+1):
# Determine which folder the current pair belongs toifi<=cumulative_counts[0]:
folder=folders[0]
elifi<=cumulative_counts[1]:
folder=folders[1]
elifi<=cumulative_counts[2]:
folder=folders[2]
else:
folder=folders[3]
# Move both the .jpg and .json filesforextin ['jpg', 'json']:
filename=f'sa_{i}.{ext}'src=os.path.join(source_dir, filename)
dst=os.path.join(source_dir, folder, filename)
ifos.path.exists(src):
shutil.move(src, dst)
else:
print(f"File not found: {src}")
The text was updated successfully, but these errors were encountered:
``I am reproducing the result.
For the SAM dataset download, I found this link: SAM
The dataset config file in this repo shows that it is divided into 4 subset. However, the original SAM dataset did not do that. Instead, it is just .jpg and .json file in the root folder.
Therefore, I am wondering if I should write a script to split the dataset into 4 subsets.
Here is my current code for doing that:
The text was updated successfully, but these errors were encountered: