コード例 #1
0
def __good(user_name):
    check_path = utils.get_label_file_path(user_name)
    good_path = utils.get_label_done_file_path(user_name)
    if check_path is None or good_path is None:
        return "无法找到回滚文件"
    ldp = LabelDoneProcessor(src_path=check_path, dst_path=good_path)
    return ldp.good()
コード例 #2
0
def get_one_image(user_name):
    user_file_path = utils.get_label_file_path(user_name)

    from commons.file import ReadFile
    fp = ReadFile(user_file_path)
    line, num = fp.read_one_line()  # num=-1意味着没有剩余了

    logger.debug("获得标注图片:%s", line)
    return line, num
コード例 #3
0
def get_status(user_name):
    # 用户标注的文件
    txt_path = utils.get_label_file_path(user_name)
    logger.debug("等待用户标注的文件:%s", txt_path)

    if not os.path.exists(txt_path):
        logger.info("等待用户标注的文件[%s]不存在", txt_path)
        return False
    else:
        return True
コード例 #4
0
 def run(self):
     if lock.acquire():
         logger.info("邮箱前缀为" + self.args + "的任务开始执行")
         # time.sleep(3)
         from commons.file import AssignFileProcessor
         user_file_path = utils.get_label_file_path(self.args)
         repository_file = utils.get_label_repository_file_path()
         afp = AssignFileProcessor(repository_file, user_file_path,
                                   conf.task_num_person)
         afp.process()
         logger.info("邮箱前缀为" + self.args + "的任务获取成功")
         lock.release()
コード例 #5
0
def __bad(user_name):
    good_path = utils.get_label_file_path(user_name)
    bad_path = utils.get_bad_txt_file_path(user_name)
    ldp = LabelDoneProcessor(good_path, bad_path)
    return ldp.bad()
コード例 #6
0
def __label_me(user_name, type, img_path):
    user_label_file_path = utils.get_label_file_path(user_name)
    user_label_done_file_path = utils.get_label_done_file_path(user_name)
    ldp = LabelDoneProcessor(user_label_file_path, user_label_done_file_path)
    return ldp.label(img_path, type)