下面笔记本中的Python代码:
**from keras.applications.resnet50 import preprocess_input, decode_predictions
def ResNet50_predict_labels(img_path):
img = preprocess_input(path_to_tensor(img_path))
return np.argmax(ResNet50_model.predict(img))
def dog_detector(img_path):
prediction = ResNet50_predict_labels(img_path)
return ((prediction <= 268) & (prediction >= 151))**
dog_pic_sum_from_human_files = np.sum([1 if dog_detector(img_path1) \
else 0 for img_path1 in list(human_files_short)])
dog_pic_sum = np.sum([1 if dog_detector(img_path2) \
else 0 for img_path2 in list(dog_files_short)])**
下面的Windows错误日志:
错误应用:python.exe,版本:3.5.3150.1013,时间戳:0x58ae5709
模块ucrtbase.dll版本:10.0.15063.413,时间戳:0x5ba8b66e
异常代码:0xc0000409
偏移量:0x00000000000734be
PID:0x4c4
应用路径:D:\ softinstalled \ task \ anaconda3 \ envs \ dog-project \ python.exe
模块路径:C:\ Windows \ System32 \ ucrtbase.dll
报告ID:93719113-f242-4e45-948d-9df8437fe2ac