本文整理汇总了Python中dataset.Dataset.create_ds方法的典型用法代码示例。如果您正苦于以下问题:Python Dataset.create_ds方法的具体用法?Python Dataset.create_ds怎么用?Python Dataset.create_ds使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dataset.Dataset
的用法示例。
在下文中一共展示了Dataset.create_ds方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: learn
# 需要导入模块: from dataset import Dataset [as 别名]
# 或者: from dataset.Dataset import create_ds [as 别名]
def learn(self, dataset_name=''):
if not dataset_name:
dataset = Dataset.create_ds(self.options, prefix='learn')
else:
dataset = Dataset.get_ds(self.options, dataset_name)
try:
while True:
controls = self.c.getUpdates()
state = self.izzy.getState()
self.update_gripper(controls)
controls = self.controls2simple(controls)
if not all(int(c) == 0 for c in controls):
frame = self.bc.read_frame(show=self.options.show, record=self.options.record, state=state)
dataset.stage(frame, controls, state)
print "supervisor: " + str(controls)
time.sleep(0.05)
except KeyboardInterrupt:
pass
dataset.commit()
if self.options.record:
self.bc.save_recording()
示例2: deploy
# 需要导入模块: from dataset import Dataset [as 别名]
# 或者: from dataset.Dataset import create_ds [as 别名]
def deploy(self, dataset_name=""):
net = caffe.Net(self.options.model_path, self.options.weights_path, caffe.TEST)
if not dataset_name:
dataset = Dataset.create_ds(self.options, prefix="deploy")
else:
dataset = Dataset.get_ds(self.options, dataset_name)
try:
while True:
controls = self.c.getUpdates()
state = self.izzy.getState()
if self.c.override():
# supervised
controls = self.c.getUpdates()
self.update_gripper(controls)
controls = self.controls2simple(controls)
if not all(int(c) == 0 for c in controls):
frame = self.bc.read_frame(show=self.options.show, record=self.options.record, state=state)
dataset.stage(frame, controls, state)
print "supervisor: " + str(controls)
else:
# autonomous
frame = self.bc.read_binary_frame(record=self.options.record, state=state)
data4D = np.zeros([1, 3, 125, 125])
frame = frame / 255.0
data4D[0,0,:,:] = frame
data4D[0,1,:,:] = frame
data4D[0,2,:,:] = frame
net.forward_all(data=data4D)
net_controls = net.blobs['out'].data.copy()[0]
print controls
controls = self.net2controls(net_controls)
self.update_gripper(controls)
time.sleep(0.03)
except KeyboardInterrupt:
pass
dataset.commit()
if self.options.record:
self.bc.save_recording()
示例3: rollout_tf
# 需要导入模块: from dataset import Dataset [as 别名]
# 或者: from dataset.Dataset import create_ds [as 别名]
def rollout_tf(self, dataset_name=''):
net = self.options.tf_net
sess = self.options.tf_sess
if not dataset_name:
dataset = Dataset.create_ds(self.options, prefix='learn')
else:
dataset = Dataset.get_ds(self.options, dataset_name)
try:
while True:
controls = self.c.getUpdates()
state = self.izzy.getState()
if self.c.override():
# supervised
self.update_gripper(controls)
controls = self.controls2simple(controls)
if not all(int(c) == 0 for c in controls):
frame = self.bc.read_frame(show=self.options.show, record=self.options.record, state=state)
dataset.stage(frame, controls, state)
print "supervisor: " + str(controls)
else:
# autonomous
frame = self.bc.read_binary_frame(record=self.options.record, state=state)
frame = np.reshape(frame, (125, 125, 1))
net_controls = net.output(sess, frame)
print controls
controls = self.net2controls(net_controls)
self.update_gripper(controls)
time.sleep(0.03)
except KeyboardInterrupt:
pass
sess.close()
dataset.commit()
if self.options.record:
self.bc.save_recording()