• 语音识别bug


    #       如果消息为200,则表示talker在交互过程中未识别到用户的语音输入,开启人脸验证确认用户是否还在面前(排除噪声的影响)
    #       确认时间为3秒,3秒都没有人脸,则确认用户不在.确认用户还在,则提醒对方重新说一下,如果不在,则取消交互,进入等待人脸介入环节.
    #        TODO:有人的话确认是否为本轮交互的同一人.
            elif loop_count.data == 200:#unrecognized voice, reconfig if there still people talking to
                start_time = time.time()
                while True:
                    # Capture frame-by-frame
                    ret, frame = cap.read()
                    if ret:
                        cv2.imwrite('tmp.jpg',frame)
                    with open("tmp.jpg", "rb") as fp:
                        image_binary = fp.read()
                        image_binary = base64.b64encode(image_binary)
                        post_data = {"Image":image_binary}
                        body = JSONEncoder().encode(post_data)
                        req = urllib2.Request(url, body)
                        response = urllib2.urlopen(req).read()
                        body = JSONDecoder().decode(response)
                        rospy.loginfo(body)
    
                    if body['Id'] == 'UNKNOWN' or body['Id'] == 'None':#reconfiged nobody
                        msg.is_staff = 0
                        msg.name = 'nobody'
                        #self.face_result_pub.publish(msg)
                        print "nobody"
                        now_time = time.time()
                        if now_time - start_time <= 3:
                            continue
                        else:
                                self.face_result_pub.publish(msg)
                            break
                    else:#reconfiged unregistered people
                        msg.is_staff = 0
                        msg.name = 'unknown'
                        self.face_result_pub.publish(msg)
                        break
            else:
                pass

    修改直到3秒结束,再发布 self.face_result_pub.publish(msg)

  • 相关阅读:
    ORA-00904:标识符无效
    SQL错误:ORA-12899
    ORA-01722:无效数字
    科学记数法
    报表软件公司悬赏 BUG,100块钱1个的真实用意
    Perl--包
    Perl--正则
    Perl use strict 控制变量
    Oracle不删除用户,导入数据
    从别人的角度理解这个世界——Leo鉴书80
  • 原文地址:https://www.cnblogs.com/feifanrensheng/p/10250035.html
Copyright © 2020-2023  润新知