def predict_heatmap(pdf_path, page_num, model, img_dim=<NUM_LIT>, img_dir="<STR_LIT>"):
if not os.path.isdir(img_dir):<EOL><INDENT>print("<STR_LIT>".format(img_dir))<EOL>os.makedirs(img_dir)<EOL><DEDENT>pdf_name = os.path.splitext(os.path.basename(pdf_path))[<NUM_LIT:0>]<EOL>img_path = os.path.join(img_dir, pdf_name + "<STR_LIT>".format(page_num))<EOL>if not os.path.isfile(img_path):<EOL><INDENT>save_image(pdf_path, img_path, page_num)<EOL><DEDENT>image = load_img(img_path, grayscale=True, target_size=(img_dim, img_dim))<EOL>image = img_to_array(image, data_format=K.image_data_format())<EOL>image = (<EOL>image.reshape((img_dim, img_dim, <NUM_LIT:1>))<EOL>.repeat(<NUM_LIT:3>, axis=<NUM_LIT:2>)<EOL>.reshape((<NUM_LIT:1>, img_dim, img_dim, <NUM_LIT:3>))<EOL>)<EOL>return (<EOL>image.astype(np.uint8).reshape((img_dim, img_dim, <NUM_LIT:3>)),<EOL>model.predict(image).reshape((img_dim, img_dim)),<EOL>)<EOL>
Return an image corresponding to the page of the pdf
documents saved at pdf_path. If the image is not found in img_dir this
function creates it and saves it in img_dir.

:param pdf_path: path to the pdf document.
:param page_num: page number to create image from in the pdf file.
:return: