进化图像匹配模拟的新型适应度测量
我相信很多人已经看过使用遗传算法生成与样本图像匹配的图像的演示。 你从噪声开始,逐渐地它越来越类似于目标图像,直到你得到或多或少精确的副本。
然而,我见过的所有示例都使用相当简单的逐像素比较,从而导致最终图像的“淡入”相当可预测。 我正在寻找的是更新颖的东西:一种比朴素方法更接近我们所认为的“相似”的健身指标。
我心里没有具体的结果 - 我只是在寻找比默认值更“有趣”的东西。 建议?
I'm sure many people have already seen demos of using genetic algorithms to generate an image that matches a sample image. You start off with noise, and gradually it comes to resemble the target image more and more closely, until you have a more-or-less exact duplicate.
All of the examples I've seen, however, use a fairly straightforward pixel-by-pixel comparison, resulting in a fairly predictable 'fade in' of the final image. What I'm looking for is something more novel: A fitness measure that comes closer to what we see as 'similar' than the naive approach.
I don't have a specific result in mind - I'm just looking for something more 'interesting' than the default. Suggestions?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

发布评论
评论(4)
我同意其他贡献者的观点,即这并非易事。 我还要补充一点,这在商业上非常有价值 - 例如,希望保护其视觉知识产权的公司会非常高兴能够在互联网上搜索与其徽标相似的图像。
我的幼稚方法是在多个图像上训练模式识别器,每个图像都是从目标图像生成的,并对其应用了一个或多个变换:例如,以任一方式旋转几度; 无论如何,都会平移几个像素; 同一图像的不同比例; 各种模糊和效果(卷积掩模在这里很好)。 我还会为每个图像添加一些随机噪声。 样本越多越好。
训练全部可以离线完成,因此不会导致运行时性能问题。
一旦你训练了模式识别器,你就可以将其指向 GA 群体图像,并从识别器中获得一些标量分数。
就我个人而言,我喜欢径向基础网络。 训练快。 我会从太多的输入开始,然后通过主成分分析 (IIRC) 来减少它们。 输出可能只是相似性度量和相异性度量。
最后一件事; 无论您采用哪种方法 - 您可以在博客中介绍它,发布演示,等等; 让我们知道你的进展如何。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
我假设你正在谈论类似 Roger Alsing 的东西程序。
我实现了这个版本,所以我也对其他健身功能感兴趣,尽管我是从提高性能而不是美观的角度来考虑的。 我预计由于进化过程的性质,总会有一些“淡入”的元素(尽管调整进化运算符可能会影响其外观)。
除了小图像之外,逐像素比较的成本可能很高。 例如,我使用的 200x200 像素图像有 40,000 个像素。 如果每个像素有三个值(R、G 和 B),则必须将 120,000 个值合并到单个图像的适合度计算中。 在我的实现中,我在进行比较之前缩小图像,以便减少像素。 代价是进化图像的准确性略有降低。
在研究替代健身功能时,我遇到了一些使用 YUV 色彩空间 而不是 RGB 的建议,因为这更符合人类的认知。
我的另一个想法是仅比较随机选择的像素样本。 如果不尝试的话,我不确定这会有多好。 由于每次评估所比较的像素都会不同,因此它将具有保持群体内多样性的效果。
除此之外,您还处于计算机视觉领域。 我预计这些依赖于特征提取的技术每张图像的成本会更高,但如果它们导致需要更少的代数来实现可接受的结果,那么它们总体上可能会更快。 您可能想要研究 PerceptualDiff 库。 另外,此页面显示了一些 Java可用于根据特征而不是像素来比较图像相似性的代码。
I assume you're talking about something like Roger Alsing's program.
I implemented a version of this, so I'm also interested in alternative fitness functions, though I'm coming at it from the perspective of improving performance rather than aesthetics. I expect there will always be some element of "fade-in" due to the nature of the evolutionary process (though tweaking the evolutionary operators may affect how this looks).
A pixel-by-pixel comparison can be expensive for anything but small images. For example, the 200x200 pixel image I use has 40,000 pixels. With three values per pixel (R, G and B), that's 120,000 values that have to be incorporated into the fitness calculation for a single image. In my implementation I scale the image down before doing the comparison so that there are fewer pixels. The trade-off is slightly reduced accuracy of the evolved image.
In investigating alternative fitness functions I came across some suggestions to use the YUV colour space instead of RGB since this is more closely aligned with human perception.
Another idea that I had was to compare only a randomly selected sample of pixels. I'm not sure how well this would work without trying it. Since the pixels compared would be different for each evaluation it would have the effect of maintaining diversity within the population.
Beyond that, you are in the realms of computer vision. I expect that these techniques, which rely on feature extraction, would be more expensive per image, but they may be faster overall if they result in fewer generations being required to achieve an acceptable result. You might want to investigate the PerceptualDiff library. Also, this page shows some Java code that can be used to compare images for similarity based on features rather than pixels.