miojizzy commited on
Commit
d4891e7
·
1 Parent(s): 76b588d

Update mhr_recognize_datasets.py

Browse files
Files changed (1) hide show
  1. mhr_recognize_datasets.py +1 -1
mhr_recognize_datasets.py CHANGED
@@ -71,13 +71,13 @@ class MHRRecognizeDatasets(datasets.GeneratorBasedBuilder):
71
  # if self.config.name == "whole":
72
  # Read csv with image labels
73
  label_csv = pd.read_csv(label)
 
74
  #print("2:", label_csv)
75
  for i, path in enumerate(images):
76
  file_name = os.path.basename(path)
77
  #print("3:", i, path, file_name)
78
  # Get image id to filter the respective row of the csv
79
  image_label = label_csv[label_csv["name"] == file_name]['label'].values[0]
80
- image_label = -1 if np.isnan(image_label) else image_label
81
  print("5:", type(image_label), image_label)
82
  yield i, {
83
  "image": path,
 
71
  # if self.config.name == "whole":
72
  # Read csv with image labels
73
  label_csv = pd.read_csv(label)
74
+ label_csv = label_csv.fillna(-1)
75
  #print("2:", label_csv)
76
  for i, path in enumerate(images):
77
  file_name = os.path.basename(path)
78
  #print("3:", i, path, file_name)
79
  # Get image id to filter the respective row of the csv
80
  image_label = label_csv[label_csv["name"] == file_name]['label'].values[0]
 
81
  print("5:", type(image_label), image_label)
82
  yield i, {
83
  "image": path,