Open RahulB117 opened 5 years ago
Is your test set always 2-3 videos? With that small of a sample size, it's hard to judge how meaningful these results are. For my experiments, I used the videos for subjects 1-16 as training data (in total 64 videos/activity) and the videos for subjects 17-25 as test data (in total 36 videos/activity). I suggest you re-run the code with this split and the owen.yaml
config file (just change the filepaths, nothing else). You should get results which are ~58-83% classification accuracy for any activity. After confirming that this works, you can make adjustments of your own.
You might also want to normalize the features, which is theoretically helpful for stuff like this. I notice from your output that the normalization stats aren't being loaded, which is mostly my fault since the process for generating the stats file is very counterintuitive. In order to generate said file you need to run an "extract" pass with extract_features > normalize
set to False
in the config file (the reason being that we want to compute stats over the whole unnormalized training dataset). After generating the stats file, you'd then have to do everything over again: re-extract the features, build models, etc.
But for convenience I'll include my own norm_stats.pkl
file, which you ought to be able to use if you divide up the data as I've outlined above. Just put it in the directory somewhere and set the value of stats_path
as appropriate in the config file.
From a clean pull of the repository and KTH data, the full steps I'm suggesting are:
redo your train/test splits for the KTH data
unzip the file above to get `norm_stats.pkl`
edit filepaths as appropriate in `config/owen.yaml`
python main.py extract config/owen.yaml
python main.py build config/owen.yaml
python main.py classify config/owen.yaml
Thank you so much, I’ll make the following changes and get back to you as soon as I can.
Sent from my iPhone
On 03-Apr-2019, at 6:32 AM, Owen Jow notifications@github.com wrote:
Is your test set always 2-3 videos? With that small of a sample size, it's hard to judge how meaningful these results are. For my experiments, I used the videos for subjects 1-16 as training data (in total 64 videos/activity) and the videos for subjects 17-25 as test data (in total 36 videos/activity). I suggest you re-run the code with this split and the owen.yaml config file (just change the filepaths, nothing else). You should get results which are ~58-83% classification accuracy for any activity. After confirming that this works, you can make adjustments of your own.
You might also want to normalize the features, which is theoretically helpful for stuff like this. I notice from your output that the normalization stats aren't being loaded, which is mostly my fault since the process for generating the stats file is very counterintuitive. In order to generate said file you need to run an "extract" pass with extract features > normalize set to False in the config file (the reason being that we want to compute stats over the whole unnormalized training dataset). After generating the stats file, you'd then have to do everything over again: re-extract the features, build models, etc.
But for convenience I'll include my own norm_stats.pkl file, which you ought to be able to use if you divide up the data as I've outlined above. Just put it in the directory somewhere and set the value of stats_path as appropriate in the config file.
norm_stats.zip
In summary
From a clean pull of the repository and KTH data, the full steps I'm suggesting are:
redo your train/test splits for the KTH data unzip the file above to get
norm_stats.pkl
edit filepaths as appropriate inconfig/owen.yaml
python main.py extract config/owen.yaml python main.py build config/owen.yaml python main.py classify config/owen.yaml — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.
Greetings ohjay, After following the above steps with n_components = 4, I got the following accuracies,
Boxing : 0.3333 Handclapping : 0.1111 Handwaving : 1.00 Walking : 0 Running : 0
I'm not sure as to why the accuracies for the last three activities were as above. After modifying n_components to 3 ( n_components = 3) in the build_model section, I got the following accuracies ,
Boxing : 0.25 Handclapping : 0.22 Handwaving : 0.8611 Walking : 0.8055 Running : 0.9422
Could you please let me know if I should change the value of another component? Apart from that, is it possible to use another dataset apart from Kth as I want to try the one here ( https://www3.cs.stonybrook.edu/~kyun/research/kinect_interaction/index.html ) and also what is the functionality of sequences.txt ?
Thank you in advance
Is there a reason you're not using the jogging class? I could imagine a scenario in which its absence would cause trouble, although it's hard to say for sure. If you really have everything set up the same way I do, there shouldn't be that much variance in the results.
I updated the setup script and added a new config file. Just to make sure everything is the same, could you re-clone the repository somewhere and run the new setup script+config file?
git clone git@github.com:ohjay/hmm_activity_recognition.git
cd hmm_activity_recognition
./get_data.sh
python main.py extract config/quickstart.yaml
python main.py build config/quickstart.yaml
python main.py classify config/quickstart.yaml
You might also want to check that your versions are the same, particularly for OpenCV and hmmlearn
.
As far as I'm aware, there's no need to change any other parameters if you just want to replicate my results. But of course the parameters can make a big difference on results in general, so it's true you'll ultimately want to tune them.
You should be able to switch out the dataset pretty easily if you're able to set up the same directory structure as data
(basically with videos in activity-labeled folders). You might need to change the reading process (see process_video
in scripts/extract_features.py
) if the new videos aren't AVI files.
sequences.txt
is specific to the KTH dataset. It just gives the frame ranges corresponding to different "sequences" within each video. If you're using a new dataset, you should be able to delete sequences_path
from the config file without any repercussions.
Thank you for getting back to me on this. I ran the above specifications with the running dataset and got your results. A colleague within my group mentioned that I should try doing a cross fold validation of this. Is it possible to do so, if so how must I proceed?
On Sun, Apr 14, 2019 at 6:10 PM Owen Jow notifications@github.com wrote:
Is there a reason you're not using the jogging class? I could imagine a scenario in which its absence would cause trouble, although it's hard to say for sure. If you really have everything set up the same way I do, there shouldn't be that much variance in the results.
I updated the setup script and added a new config file. Just to make sure everything is the same, could you re-clone the repository somewhere and run the new setup script+config file?
git clone git@github.com:ohjay/hmm_activity_recognition.git cd hmm_activity_recognition ./get_data.sh python main.py extract config/quickstart.yaml python main.py build config/quickstart.yaml python main.py classify config/quickstart.yaml
You might also want to check that your versions are the same https://github.com/ohjay/hmm_activity_recognition/blob/master/requirements.txt, particularly for OpenCV and hmmlearn.
As far as I'm aware, there's no need to change any other parameters if you just want to replicate my results. But of course the parameters can make a big difference on results in general, so it's true you'll ultimately want to tune them.
You should be able to switch out the dataset pretty easily if you're able to set up the same directory structure as data (basically with videos in activity-labeled folders). You might need to change the reading process (see process_video in scripts/extract_features.py) if the new videos aren't AVI files.
sequences.txt is specific to the KTH dataset. It just gives the frame ranges corresponding to different "sequences" within each video. If you're using a new dataset, you should be able to delete sequences_path from the config file without any repercussions.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ohjay/hmm_activity_recognition/issues/3#issuecomment-482966656, or mute the thread https://github.com/notifications/unsubscribe-auth/AuiwhWKzxR4UJS1hdF7ZuIwlAHz097nbks5vgyG_gaJpZM4cVTlY .
Sure it's possible. Given the current infrastructure, the simplest approach would probably be to write a shell script akin to get_data.sh
that would continually (a) rearrange the train/validation splits (switching up the validation split each time), (b) run the usual set of commands, and (c) send the output to a file.
I've begun work on that shell script but I've run into a few problems regarding the usage of another dataset. I'm unable to build any models. I get this error.
model 0:
Initializing gmm
model with args:
{'init_params': 't', 'verbose': True, 'n_components': 4, 'transmat_prior':
array([[0.33333333, 0.33333333, 0.33333333, 0. ],
[0. , 0.33333333, 0.33333333, 0.33333333],
[0. , 0. , 0.5 , 0.5 ],
[0. , 0. , 0. , 1. ]]), 'n_iter': 20}
subsample p: 0.50
[o] Loaded feature matrix: (1026, 80)
[o] Loaded n_sequences: 20
[o] Fitting to feature matrix of shape (492, 80).
1 9200.2093 +nan
2 15859.2034 +6658.9941
3 15859.3046 +0.1013
4 15913.4253 +54.1206
5 18364.1924 +2450.7672
6 23488.2184 +5124.0260
Traceback (most recent call last):
File "main.py", line 103, in
I'm not sure how to fix this. Could you please help me out? Thanks in advance
http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail Virus-free. www.avg.com http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail <#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
On Mon, Apr 22, 2019 at 7:57 PM Owen Jow notifications@github.com wrote:
Sure it's possible. Given the current infrastructure, the simplest approach would probably be to write a shell script akin to get_data.sh https://github.com/ohjay/hmm_activity_recognition/blob/154c3c8e97d0c82bbee4bd3efded2765cbe450b4/get_data.sh#L32 that would continually (a) rearrange the train/validation splits (switching up the validation split each time), (b) run the usual set of commands, and (c) send the output to a file.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ohjay/hmm_activity_recognition/issues/3#issuecomment-485432694, or mute the thread https://github.com/notifications/unsubscribe-auth/ALULBBIKXE62ODQJR5B64Y3PRXDLVANCNFSM4HCVHFMA .
I'm not too sure either. Based on a quick internet search, you might want to try upgrading hmmlearn
to version 0.2.1+, as they apparently rewrote the GMMHMM
class to avoid this kind of problem. You can also try switching m_type
to gaussian
in the config file. I assume you've already checked that the features are sensible.
Good evening ohjay, Thank you so much for clarifying the previous error that occurred during execution. I have run into this new problem here as seen from the attached screenshots.
I seem to be getting a 100% accuracy during testing for boxing yet 0% for anything else. I have tried this with the other activities but only boxing is recognised, but even then a 100% ( 1.0) test accuracy is too high.
Output : config = yaml.load(open(args.config, 'r'))
Could you please help me. Thank you in advance.