def _postprocess(self, data): outputs = {} # 输入参数 image = data['image'] input_size = data['input_size'] # 模型识别结果 image_data = image_preporcess(image.copy(), [input_size, input_size]) predict = self.model_object.predict(image_data) # 结果绘制到图 results = detect(predict, image.shape[:2], input_size, data['min_score']) image, recognizer = draw_bbox(image, results, data['show_box_label']) # 预测次数+1 print('预测次数:', self.count) self.count += 1 # 输出数据,show_image是否输出识别处理的base64图片 outputs['recognizer_data'] = recognizer if data['show_image']: itb64 = image_to_base64(image) outputs['predicted_image'] = itb64 return outputs
def view_donation_center(request, id): donation_center = get_object_or_404(DonationCenter, pk=id) context = { "donation_center": donation_center, "name": donation_center.name, "phone_number_img": image_to_base64(text_to_image(donation_center.phone, 300, 50)) if donation_center.phone else None, "whatsapp": '595'+donation_center.phone[1:]+'?text=Hola+'+donation_center.name + ',+te+escribo+por+el+anuncio+de+donación+que+hiciste:+' + '+https:'+'/'+'/'+'ayudapy.org/donaciones/'+donation_center.id.__str__() if donation_center.phone else None, } return render(request, "donation_center/details.html", context)