classification and training using matlab hmm tool
Afficher commentaires plus anciens
I am trying to classify a gesture using hmm, I have done the following
- 1- feature extraction
- 2- used SOM tool to quantize the features.
- 3- now i have observation Matrix for the gesture and its repeated gesture, each row is an obseravation vector for each gesture.
- 4- created the initial transission and emission matrix of the hmm
- 5- i use hmmtrain(data,transion,emissio) and i have the new transision and emission matricies.
- 6- when i use hmmcode(data,A,B) error occures.
- attached the input data (all observations)
- the following is the output with the error occuring while running
- after that the code used.
error: " obs_T =
29
32
36
15
22
16
49
42
35
19
44
43
11
33
45
27
37
46
6
13
18
31
1
4
40
34
10
17
24
21
23
5
38
28
obs_numt =
1
5
6
17
19
20
33
34
49
65
69
71
78
80
97
99
102
106
113
114
116
127
129
131
145
146
161
163
170
193
241
257
273
289
M =
34
Error using hmmdecode (line 100) SEQ must consist of integers between 1 and 34.
Error in hmmtrain (line 213) [~,logPseq,fs,bs,scale] = hmmdecode(seq,guessTR,guessE);
Error in test_known_sample_standalone_toask (line 37) [TRANS_EST2, EMIS_EST2] = hmmtrain(cluster_m,Trans_Q,Emis_g)"
here is the code i am using.
% TEST test script for HHM package function test_known_sample_standalone()
clc;
close all;
%observation sequance that will be used.
cluster_m=[3 2 1;4 5 1;2 3 5;4 1 2];
[x y]=size(cluster_m)
O=cluster_m;
%getting all the observation in a the order of its appearance.
obs_T=unique(O);
[~,index] = unique(O,'first'); %# Capture the index, ignore the actual values
obs_T=O(sort(index))
[~,obs_numt]=ismember(obs_T,O)
%number of distinct observations
M=length(obs_T);
n=length(O); % the number of sequances.
Q=10; %10 states N states ( Sj)
%Generating Transission matrix NxN
nu = rand(1,Q); nu = nu ./ (sum(nu, 2)*ones(1, Q));
%Generating Transission matrix NxN
Trans_Q = rand(Q,Q); Trans_Q = Trans_Q ./ (sum(Trans_Q, 2)*ones(1, Q));
%generating Emission Matrix NxM
Emis_g = rand(Q, M); Emis_g = Emis_g ./ (sum(Emis_g, 2)*ones(1, M));
%testing for first observation vector [TRANS_EST2, EMIS_EST2] = hmmtrain(cluster_m(1,:),Trans_Q,Emis_g)
PSTATES = hmmdecode(cluster_m,TRANS_EST2, EMIS_EST2)
Réponses (0)
Catégories
En savoir plus sur Deep Learning Toolbox dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!