QOJ.ac

QOJ

时间限制: 6 s 内存限制: 1024 MB 总分: 100

#5668. 细胞核检测

统计

国际癌症病理公司 (ICPC) 是一家致力于开发人工智能 (AI) 模型,从肿瘤病理图像中检测癌细胞的公司。在预处理阶段,AI 模型会检测病理图像上的细胞核,并使用所谓的“边界框”将每个细胞核框选出来,如图 12 所示。边界框是一个矩形,用 4 元组 $(x_1, y_1, x_2, y_2)$ 表示,其中 $(x_1, y_1)$ 是其左上角坐标,$(x_2, y_2)$ 是其右下角坐标。由 AI 模型绘制的边界框称为检测边界框。

图 12:带有检测边界框的病理图像。*

为了评估 AI 模型的性能,ICPC 的研究人员准备了一组测试数据(病理图像),医学专家会预先通过边界框标注出真实情况(即细胞核)。这些边界框称为真实边界框。然后,研究人员将应用 AI 模型在测试数据集上检测细胞核,并查看检测到了多少个真实细胞核。如果存在一个检测边界框 $D$ 与真实边界框 $G$ 的重叠面积至少达到 $G$ 面积的一半,即 $|D \cap G|/|G| \ge 1/2$,我们就称带有真实边界框 $G$ 的细胞核被 AI 模型检测到了。注意,一个检测边界框可能与两个或多个真实边界框重叠,但每个检测边界框只能被认为检测到了其中一个。图 13 展示了真实边界框和检测边界框的示例。此外,由于细胞核的大小有限,边界框的宽度和高度也有一定的限制。

给定一组真实边界框和一组检测边界框,请编写一个程序来确定检测到的细胞核的最大数量。

图 13:带有真实边界框(蓝色框)和检测边界框(绿色框)的病理图像。*

输入格式

第一行包含一个整数 $t$,表示测试用例的数量。对于每个测试用例,第一行包含一对整数 $m$ 和 $n$,由空格分隔,分别表示真实边界框和检测边界框的数量。接下来的 $m + n$ 行表示边界框坐标的 4 元组 $(x_1, y_1, x_2, y_2)$,每两个连续整数之间由空格分隔。前 $m$ 行表示真实边界框,随后的 $n$ 行表示检测边界框。

输出格式

每个测试用例输出一行一个整数 $k$,其中 $k$ 是给定检测边界框所能检测到的细胞核的最大数量。

数据范围

  • $1 \le t \le 5$。
  • $1 \le m, n \le 50000$。
  • $0 \le x_1, y_1, x_2, y_2 \le 2000$。
  • 变量 $t, m, n, x_1, y_1, x_2, y_2$ 均为整数。
  • 边界框的宽度和高度的最大长度为 4。
  • 不存在两个真实边界框具有包含关系(即一个包含另一个),检测边界框亦然。

样例

样例输入 1

3
2 2
1 1 3 3
3 3 5 5
2 2 4 4
4 4 6 6
2 3
1 1 3 3
3 3 5 5
1 3 3 5
2 1 4 5
3 1 5 3
3 3
1 1 2 2
2 2 3 3
3 3 4 4
1 1 3 3
2 2 4 4
3 3 5 5

样例输出 1

0
1
3

*注:图中的图像引用自论文 URL:https://www.kitware.com/cell-nuclei-detection-on-whole-slide-histopathology-images-using-histomicstk-and-faster-r-cnn-deep-learning-models/。

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.