|
@@ -72,9 +72,6 @@ class PaddleTableClsModel:
|
|
|
result = self.sess.run(None, {"x": x})
|
|
result = self.sess.run(None, {"x": x})
|
|
|
idx = np.argmax(result)
|
|
idx = np.argmax(result)
|
|
|
conf = float(np.max(result))
|
|
conf = float(np.max(result))
|
|
|
- # logger.debug(f"Table classification result: {self.labels[idx]} with confidence {conf:.4f}")
|
|
|
|
|
- if idx == 0 and conf < 0.8:
|
|
|
|
|
- idx = 1
|
|
|
|
|
return self.labels[idx], conf
|
|
return self.labels[idx], conf
|
|
|
|
|
|
|
|
def list_2_batch(self, img_list, batch_size=16):
|
|
def list_2_batch(self, img_list, batch_size=16):
|
|
@@ -134,7 +131,7 @@ class PaddleTableClsModel:
|
|
|
x = np.stack(res_imgs, axis=0).astype(dtype=np.float32, copy=False)
|
|
x = np.stack(res_imgs, axis=0).astype(dtype=np.float32, copy=False)
|
|
|
return x
|
|
return x
|
|
|
def batch_predict(self, img_info_list, batch_size=16):
|
|
def batch_predict(self, img_info_list, batch_size=16):
|
|
|
- imgs = [item["table_img"] for item in img_info_list]
|
|
|
|
|
|
|
+ imgs = [item["wired_table_img"] for item in img_info_list]
|
|
|
imgs = self.list_2_batch(imgs, batch_size=batch_size)
|
|
imgs = self.list_2_batch(imgs, batch_size=batch_size)
|
|
|
label_res = []
|
|
label_res = []
|
|
|
with tqdm(total=len(img_info_list), desc="Table-wired/wireless cls predict", disable=True) as pbar:
|
|
with tqdm(total=len(img_info_list), desc="Table-wired/wireless cls predict", disable=True) as pbar:
|
|
@@ -144,9 +141,6 @@ class PaddleTableClsModel:
|
|
|
for img_res in result[0]:
|
|
for img_res in result[0]:
|
|
|
idx = np.argmax(img_res)
|
|
idx = np.argmax(img_res)
|
|
|
conf = float(np.max(img_res))
|
|
conf = float(np.max(img_res))
|
|
|
- # logger.debug(f"Table classification result: {self.labels[idx]} with confidence {conf:.4f}")
|
|
|
|
|
- # if idx == 0 and conf < 0.8:
|
|
|
|
|
- # idx = 1
|
|
|
|
|
label_res.append((self.labels[idx],conf))
|
|
label_res.append((self.labels[idx],conf))
|
|
|
pbar.update(len(img_batch))
|
|
pbar.update(len(img_batch))
|
|
|
for img_info, (label, conf) in zip(img_info_list, label_res):
|
|
for img_info, (label, conf) in zip(img_info_list, label_res):
|