Machine Learning_实例1_SpeakingDetection

本文介绍了一个用于检测视频中人物是否说话的程序。采用了SVM和神经网络两种方法。在SVM中,使用Scikit-learn进行数据预处理、加载、训练和测试,通过网格搜索优化参数。而在神经网络中,使用Keras构建模型,包括数据预处理、训练和测试。最终,分别实现了speakingDetection接口函数以进行预测。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

[Assignment Requirements]

Write a program to detect whether a person in a video speaks or not.

  • Features:

    • S: Depicts the motion of mouth;
    • V: Depicts the degree of mouth opening.
  • Feature vector:

    • X = [Si-1 Si Si+1 Vi-1 Vi Vi+1]
      So that, the input feature vector X is an N*6 matrix, where N is the number of feature vectors.
  • Label:

    • +1: Speaking

    • -1: Not-speaking
      So that, the output label vector is an N*1 vector predY, predY(i)=-1 or 1.

[Solutions]

  • SVM

    使用Scikit-learn,即sklearn,一个Python的机器学习包。
    对于SVM问题,我们可以调用sklearn包中基于libsvm的svm模块。对于本次任务中的分类问题,我们调用其中的SVC函数(针对回归问题,可以调用SVR函数)。
    任务实现的主要步骤为:
    数据预处理-加载数据集-训练模型(网格搜索参数)-测试模型

    • 数据预处理
      原数据集training.data格式为:
      原格式
      我们通过FormatDatalibsvm.xls,按照
      http://blog.youkuaiyun.com/pangpang1239/article/details/7435842
      中所说的方式将数据处理为libsvm要求的格式,得到training.txt:
      处理后格式

    • 加载数据集
      获得特征向量xData和标签向量yData:
      xData, yData = datasets.load_svmlight_file(“training.txt”)

    • 我们再在数据中留出一部分验证集:

      traini
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值