gpt4 book ai didi

java - 使用 DL4J 评估图像,类似于 AlphaGo

转载 作者:太空宇宙 更新时间:2023-11-04 12:36:07 25 4
gpt4 key购买 nike

我最近下载了 Deeplearning for Java (DL4J),现在正在尝试使用卷积网络。我在主页和互联网上找到了一些工作示例,例如如何对图像进行分类,即识别人脸。我大致了解如何读取训练数据以及如何使用网络应识别的正确标签来标记图像(“Barack Obama - 图片 1”)。然而,从这里开始我有点卡住了。我无法理解输出的意义。就像 http://deeplearning4j.org/image-data-pipeline 上描述的那样我们使用 ImageRecordReader 读取图像并从中创建训练数据。但是,程序如何知道将一张图像分类为“巴拉克奥巴马”而不是“巴拉克奥巴马 - 样本图片 1”呢?或者网络也有这样的功能吗?我不这么认为。我的下一个问题是更改应用程序,使其不仅识别对象,还评估图像,有点像 AlphaGo 评估以图像表示的棋盘位置。那我该如何输入数据呢?例如,我可以用他们的分数来标记培训委员会状态……但我不知道这是否好。我希望这是可以理解的,我们将不胜感激帮助和最少的样本!

谢谢,祝你有美好的一天奥利弗

最佳答案

您引用的示例使用Labeled Faces in the Wild数据集,该数据集具有以下文件夹结构:

lfw
├── Aaron_Eckhart
├── Aaron_Guiel
├── Aaron_Patterson
│ ├── Aaron_Patterson_0001.jpg

ImageRecordReader 类扩展了抽象 BaseImageRecordReader 类,该类在其 initialize() 方法中使用以下行 (131-134) 来创建标签数组:

File parentDir = imgFile.getParentFile();
String name = parentDir.getName();
if(!labels.contains(name))
labels.add(name);

换句话说,它不使用 JPEG 文件的名称,而是使用其父文件夹的名称。

至于你的第二个问题:

My next problem then is to change the application to not merely recognize an object but to evaulate an image, kind of like in AlphaGo evaluating a board position represented as an image. [..] I could label for example training board states with their score ... but I do not know if that is good at all.

我建议从阅读以下论文开始: http://www.nature.com/nature/journal/v529/n7587/fig_tab/nature16961_F1.html ,以及以下大纲:https://www.tastehit.com/blog/google-deepmind-alphago-how-it-works/ (特别是从 AlphaGo 部分开始)。

AlphaGo relies on two different components: A tree search procedure, and convolutional networks that guide the tree search procedure. [..] In total, three convolutional networks are trained, of two different kinds: two policy networks and one value network. Both types of networks take as input the current game state, represented as an image.

[..]

The value network provides an estimate of the value of the current state of the game: what is the probability of the black player to ultimately win the game, given the current state? The input to the value network is the whole game board, and the output is a single number, representing the probability of a win.

The policy networks provide guidance regarding which action to choose, given the current state of the game. The output is a probability value for each possible legal move (i.e. the output of the network is as large as the board). Actions (moves) with higher probability values correspond to actions that have a higher chance of leading to a win.

关于java - 使用 DL4J 评估图像,类似于 AlphaGo,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37318692/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com