def run(self):
print 'BlobFetcher started: pid %d; ppid %d'%(os.getpid(), os.getppid())
self._parent_pid = os.getppid()
self._self_pid = os.getpid();
self._prefetch_process_id_q.put(self._self_pid);
global shared_mem_list
while True:
#blobs = get_minibatch(minibatch_db, self._num_classes)
self.self_cleanup();
if self._slots_used.empty():
continue;
slot = self._slots_used.get();
im_datas = self._funct_to_call();
for t in range(self._num_tops):
shared_mem = shared_mem_list[t][slot];
with shared_mem.get_lock():
s = np.frombuffer(shared_mem.get_obj(), dtype=np.float32);
# print s.size, self._shared_shapes[t];
shared_mem_arr = np.reshape(s, self._shared_shapes[t]);
shared_mem_arr[...] = im_datas[t].astype(np.float32, copy=True);
# print 'helper:: ',im_datas[t].min(), im_datas[t].max(), im_datas[t].mean()
self._slots_filled.put(slot);
multiple_image_multiple_label_data_layer.py 文件源码
python
阅读 25
收藏 0
点赞 0
评论 0
评论列表
文章目录