//  [python]
def get_bboxes_logi(self,cls_scores, mask_preds, img_metas, cfg, rescale=None, score_thr=True):
		_, _, b_h, b_w = mask_preds[0].shape
		crop_h, crop_w, _ = img_metas[0]['img_shape']
		ori_h, ori_w, _ = img_metas[0]['ori_shape']

		cls_scores_ori = []
		for i in range(5):
			cls_sc = cls_scores[i].clone().detach()
			cls_sc = F.interpolate(cls_sc, (ori_h, ori_w), mode='bilinear')
			cls_scores_ori.append(cls_sc)

		# cat dim: default 0
		if self.use_sigmoid:
			flatten_cls_scores = torch.cat([cls_score.permute(0, 2, 3, 1).reshape(-1, self.cls_out_channels) for cls_score in cls_scores]).sigmoid()
		else:
			flatten_cls_scores = torch.cat([cls_score.permute(0, 2, 3, 1).reshape(-1, self.cls_out_channels) for cls_score in cls_scores]).softmax(dim=1)
			flatten_cls_scores = flatten_cls_scores[:,1:]	

		for i in range(5):
			mask_preds[i] = F.interpolate(mask_preds[i],(b_h,b_w), mode='bilinear')
		mask_preds = torch.cat(mask_preds,dim=1)[0]
		# logit and class (per pixel)
		scores, labels = torch.max(flatten_cls_scores,dim=-1)

		nms_pre = cfg.get('nms_pre', -1)
		if score_thr:
			score_thr = cfg.get('score_thr', -1)
		else:
			score_thr = 0
		mask_thr = cfg.get('mask_thr_binary',-1)
		det_masks = np.array([])
		det_bboxes = np.zeros((0,5))
		det_labels = np.zeros(0).astype(int)

		if nms_pre > 0 and len(scores) >=1 and scores.max() > score_thr:
			# HERE: need to change scores for softmax
			valid_inds = torch.nonzero(scores >= score_thr).squeeze()
			if valid_inds.dim()!=0:
				scores = scores[valid_inds]
				labels = labels[valid_inds]
				mask_preds = mask_preds[valid_inds]
				if scores.shape[0] < nms_pre:
					nms_pre = scores.shape[0]
				_, topk_inds = scores.topk(nms_pre)

				scores = scores[topk_inds]
				labels = labels[topk_inds]
				mask_preds = mask_preds[topk_inds]

				mask_preds = F.interpolate(mask_preds.unsqueeze(0), (b_h*self.strides[0], b_w*self.strides[0]), mode='bilinear')
				mask_preds = mask_preds[:, :, :crop_h, :crop_w]
				mask_preds = F.sigmoid(F.interpolate(mask_preds, (ori_h, ori_w), mode='bilinear'))[0]
				mask_preds = mask_preds > mask_thr

				masks = self.nms(scores, labels, mask_preds, cfg.nms.iou_thr)
				n = len(masks)
				det_masks = []
				det_bboxes = np.zeros((n, 5))
				det_labels = np.zeros(n).astype(int)
				for i in range(n):
					det_bboxes[i, -1] = masks[i][-1]
					det_labels[i] = masks[i][-2]
					det_masks.append(masks[i][0])
				det_masks = np.array(det_masks)


				# # ==================vis====================
				# # cls_scores_ori
				# # ==================vis====================

				# imgname = img_metas[0]['filename']
				# imgname2 = imgname.split('/')
				# imgname2 = imgname2[-1][:-4]

				# img = np.array(Image.open(imgname))
				# det_masks_int = det_masks * 1
				# out_path = "vis_tmp_min"
				# out_ = os.path.join(out_path, imgname2)
				# out_cls = os.path.join(out_path, imgname2+'_cls')

				# if not os.path.exists(out_):
				# 	os.makedirs(out_)
				# if not os.path.exists(out_cls):
				# 	os.makedirs(out_cls)
				# # pdb.set_trace()
				# # vis cls
				# # cls_all = cls_color(cls_scores_ori, self.use_sigmoid, img)
				# # for i, cls_ in enumerate(cls_all):
				# # 	out_name = os.path.join(out_cls, "scale_%d"%(i) + '.jpg')
				# # 	clsim = Image.fromarray(np.uint8(cls_))
				# # 	clsim.save(out_name)
				# for i in range(5):
				# 	if self.use_sigmoid:
				# 		cls_scores_ori_i = cls_scores_ori[i].sigmoid().cpu()
				# 	else:
				# 		cls_scores_ori_i = cls_scores_ori[i].softmax(dim=1)[:,1:].cpu()
				# 	category = cls_scores_ori_i

				# 	for j in range(80):
				# 		cls_scores_ori_ij = Image.fromarray(np.uint8(cls_scores_ori_i[0,j,:,:]*255))
				# 		out_name = os.path.join(out_cls, "%02d"%(i) +'_' + "%02d"%(j)+'_'+CLASSES[j]+'.jpg')
				# 		cls_scores_ori_ij.save(out_name)

				# for i in range(det_masks_int.shape[0]):
				# 	mas = det_masks_int[i].cpu()
				# 	lab = det_labels[i]
				# 	cls_ = CLASSES[lab]
				# 	img_clone = img.copy()
				# 	img_clone[:,:,0][mas==1] = 255
				# 	img2 = Image.fromarray(img_clone)

				# 	out_name = os.path.join(out_, '{}_'.format(cls_) + str(i) + '.jpg')
				# 	img2.save(out_name)
				# # ==================vis====================

		return det_bboxes, det_labels, det_masks