返回列表

My part of the 3rd place solution

383. Abstraction and Reasoning Challenge | abstraction-and-reasoning-challenge

开始: 2020-02-13 结束: 2020-05-27 数学与计算 数据算法赛

我对于第三名解决方案的贡献

作者: Ilia Larchenko | 比赛排名: 第3名

这是我们最终解决方案的描述。虽然 @golubev 对最终结果的贡献肯定比我大,但即使是我单独的解决方案也至少能达到银牌高分段,所以我将所有源代码分享给大家。

代码和更详细的方法描述可以在这里找到:GitHub 仓库

以下是我方法的简要概述。

  • 总的来说,我的方法可以描述为基于领域特定语言(DSL)。我创建了颜色、从原始输入图像中提取的图像块以及不同二进制掩码的抽象表示。利用这些抽象,我编写了几个“预测器”,试图推导出一组用于从相应输入图像获取每个输出图像的变换,如果成功——将这些变换应用于测试输入以获得最终答案。

  • 在组队时,我已经解决了5个任务(+2个来自公开内核)。(演示其工作原理的内核)。可能还有其他任务也可以解决,但合并后我没有单独测试我的解决方案。我的方法还分别解决了训练集和验证集中的138个和96个样本。

  • 每个预测器的一般逻辑在下面的伪代码中描述(尽管对于某些类别可能有所不同)。

    for n, (input_image, output_image) in enumerate(sample['train']):
        list_of_solutions = []
        for possible_solution in all_possible_solutions:
            if apply_solution(input_image, possible_solution) == output_image:
                list_of_solutions.append(possible_solution)
        if n == 0:
            final_list_of_solutions = list_of_solutions
        else:
            final_list_of_solutions = intersection(list_of_solutions, final_list_of_solutions)
    
        if len(final_list_of_solutions) == 0:
            return None
    
    answers = []
    for test_input_image in sample['test']:
        answers.append([])
        for solution in final_list_of_solutions:
            answers[-1].append(apply_solution(test_input_image, solution))
    
    return answers
  • 在测试集上效果最好的预测器是那些恢复图像上某种马赛克(mosaic)的预测器。

  • 其他重要提示:

    • 我使用了多进程处理来显著加快计算速度,并控制每个进程使用的RAM和时间。
    • 我缓存了在任何步骤生成的所有块。没有这一点,16GB的内存通常是不够的。
    • 我广泛使用了单元测试来控制我最近的更改没有破坏任何东西(我认为这为我节省了很多时间)。
同比赛其他方案