-
Notifications
You must be signed in to change notification settings - Fork 1
/
getimages.py
31 lines (20 loc) · 997 Bytes
/
getimages.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import pandas as pd
import parser1
import os
args = parser1.arg_parse()
def readfilenames(folder):
names = []
for i in os.listdir(os.path.join(folder, 'imgs')):
names.append(i)
df_files = pd.DataFrame(names, columns=['filename'])
return df_files
def getunlabeled(folder, df_files):
df_train = pd.read_csv(os.path.join(folder, 'train.csv'), header=None, names= ['ID', 'filename'])
df_query = pd.read_csv(os.path.join(folder, 'query.csv'), header=None, names= ['ID', 'filename'])
df_gallery = pd.read_csv(os.path.join(folder, 'gallery.csv'), header=None, names= ['ID', 'filename'])
df_files = df_files[~df_files.filename.isin(df_query.filename)]
df_files = df_files[~df_files.filename.isin(df_train.filename)]
df_files = df_files[~df_files.filename.isin(df_gallery.filename)]
df_files.to_csv(os.path.join(folder, 'train_unlabeled.csv'), header=False, index=False)
files = readfilenames(args.data_dir)
getunlabeled(args.data_dir, files)