问题描述
我正在尝试利用boto在机械土耳其人中产生HIT.目标是使用已经在我的mTurk帐户上生成的通用布局,并将其图像URL传递给它以迭代方式创建HIT.
I am attempting to utilize boto to generate a HIT in mechanical turk. The goal is to use a common layout that is already generated on my mTurk account, and pass it urls of images to iteratively create HITs.
问题在于,即使正确命名了参数(如果图像网址boto也不成功),也是如此.我创建点击的示例代码是:
The issue is that even with correctly naming the parameter if for the image urls boto is not successful. My example code to create the hit is:
from boto.mturk.connection import MTurkConnection
from boto.s3.connection import S3Connection
from boto.mturk.layoutparam import LayoutParameter
from boto.s3.key import Key
import datetime
mtc = MTurkConnection(aws_access_key_id=AWSKEY,
aws_secret_access_key=AWSSKEY,
host=HOST)
#Define the layout ID to use and url to the image being used (bucket and serial defined in another place
LAYOUTID = '30W9SLHWRYCURO27D44916CUTGKDS2'
S3URL = LayoutParameter('image_url','https://s3.amazonaws.com/'+BUCKET_NAME+'/'+SERIAL)
REWARD = 0.05
#Call create_hit to generate the HIT
hit_result = mtc.create_hit(hit_layout=LAYOUTID,layout_params=S3URL, keywords=keywords_list, reward=REWARD,
duration=datetime.timedelta(7),max_assignments=1)
这会产生错误您的请求缺少必需的参数.必需的参数包括HITLayoutParameter.您尚未提供所有必需的HITLayout参数.缺少参数名称:image_url
为了确保我的布局ID具有正确的参数名称,当我检查mTurk时,我看到了(无法发布屏幕抓图):
And just to make sure, my layout ID has the correct parameter names, when I check mTurk I see (can't post a screengrab):
使用LayoutParameter有什么技巧吗?还是我以错误的方式使用create_hit?
Are there any tricks to using LayoutParameter? Or am I using create_hit in the wrong way?
推荐答案
我知道答案来不及了,但是这是您需要做的.将布局参数放入 LayoutParameter 类后,将其打包在 LayoutParameters 类中.例如.
Hi there I know it's a little too late for an answer but here's what you need to do. Package the layout parameters in a LayoutParameters class after putting them in the LayoutParameter class.eg.
......
from boto.mturk.layoutparam import LayoutParameter
from boto.mturk.layoutparam import LayoutParameters
........
S3URL = LayoutParameter('image_url','https://s3.amazonaws.com/'+BUCKET_NAME+'/'+SERIAL)
# put the layout parameter in a list/tuple and pass it to LayoutParameters
params = LayoutParameters([S3URL])
hit_result = mtc.create_hit(hit_layout=LAYOUTID,layout_params=params, keywords=keywords_list, reward=REWARD,
duration=datetime.timedelta(7),max_assignments=1)
这篇关于使用Boto和python使用参数从Layout创建mTurk HIT的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!