Kaggle competition: ASN10e Final Submission - Detect COML Faces
train = pd.merge(train, pop, how='left', left_on = 'Country_Region', right_on = 'country' )<count_missing_values>
result_dict = {"filename": [],
"person_id": [],
"id": [],
"xmin": [], "xmax": [],
"ymin": [], "ymax": []}
name_to_id = pd.read_csv("/kaggle/input/asn10e-final-submission-coml-facial-recognition/person_id_mapping.csv")
 print("predicting on img 0.jpg")
 locations, names = predict("0.jpg")
 for name, location in zip(names, locations):
name = " ".join(name.split("_"))
if name != "Unknown":
print(name)
 id_ = name_to_id[name_to_id["Person"] == name].values.tolist() [0][0]
result_dict["filename"].append("0.jpg")
 result_dict["person_id"].append(id_)
 result_dict["id"].append("0_%s" % id_)
 result_dict["xmin"].append(location[3])
 result_dict["xmax"].append(location[1])
 result_dict["ymin"].append(location[2])
 result_dict["ymax"].append(location[0])
train.isnull().sum()<count_missing_values>
print("predicting on img 1.jpg")
 locations, names = predict("1.jpg")
 for name, location in zip(names, locations):
name = " ".join(name.split("_"))
print(name)
 if name == "Joshua Lo":
name = "Rung-Chuan Lo"
if name != "Unknown":
id_ = name_to_id[name_to_id["Person"] == name].values.tolist() [0][0]
result_dict["filename"].append("1.jpg")
 result_dict["person_id"].append(id_)
 result_dict["id"].append("1_%s" % id_)
 result_dict["xmin"].append(location[3])
 result_dict["xmax"].append(location[1])
 result_dict["ymin"].append(location[2])
 result_dict["ymax"].append(location[0] )
train.isnull().sum()<count_missing_values>
print(result_dict)
 with open('submission.csv', 'w', newline='')as file:
writer = csv.writer(file)
 writer.writerow(["filename", "person_id", "id", "xmin", "xmax", "ymin", 'ymax'])
 for i in range(len(result_dict["filename"])) :
row = [result_dict["filename"][i], result_dict["person_id"][i], result_dict["id"][i], result_dict["xmin"][i],
result_dict["xmax"][i], result_dict["ymin"][i], result_dict["ymax"][i]]
writer.writerow(row)
 print(len(result_dict["filename"]))