我是使用 Apache Pig 分析图像的新手。
谁能建议我如何加载和处理图像?
我知道文本文件,
alias = load '/user/Pavan/sample.txt' using PigStorage(" ");
图片怎么处理??
最佳答案
您有几个选择,这实际上取决于您要执行的操作类型:
1)编写自定义加载函数
Pig can be used for images ,但你需要写一个 custom load function ,这可能超出您的预期。
2)使用序列文件(我的建议)
你也可以convert the image to a Sequence File ,Pig 有一个加载器文件,available in the Piggybank JAR .还有用于读取和写入序列文件的加载函数和存储函数,可通过 Twitter's Elephant Bird package 获得。 .
Here's an article about using Sequence Files on Hadoop for astronomical categorization tasks.
3) 使用 MapReduce。
根据您的任务性质,您可能会在 native MapReduce 中做得更好。
关于hadoop - 将图像加载到 pig ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20779953/