Update mhr_recognize_datasets.py
Browse files
mhr_recognize_datasets.py
CHANGED
|
@@ -2,6 +2,7 @@ import os
|
|
| 2 |
import csv
|
| 3 |
import json
|
| 4 |
import datasets
|
|
|
|
| 5 |
import pandas as pd
|
| 6 |
from pathlib import Path
|
| 7 |
|
|
@@ -76,6 +77,7 @@ class MHRRecognizeDatasets(datasets.GeneratorBasedBuilder):
|
|
| 76 |
#print("3:", i, path, file_name)
|
| 77 |
# Get image id to filter the respective row of the csv
|
| 78 |
image_label = label_csv[label_csv["name"] == file_name]['label'].values[0]
|
|
|
|
| 79 |
print("4:", image_label)
|
| 80 |
yield i, {
|
| 81 |
"image": path,
|
|
|
|
| 2 |
import csv
|
| 3 |
import json
|
| 4 |
import datasets
|
| 5 |
+
import numpy as np
|
| 6 |
import pandas as pd
|
| 7 |
from pathlib import Path
|
| 8 |
|
|
|
|
| 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 image_label is np.nan else image_label
|
| 81 |
print("4:", image_label)
|
| 82 |
yield i, {
|
| 83 |
"image": path,
|