Thanks for putting this together, excellent clear introduction. I spent a little more time on the preprocessing of data and split the lines that had a missing newline so that there were two samples on each line and dealt with another couple of problems with the raw data. This resulted in about 3 times as much data over all (just over a million samples) and using your training model got an accuracy of 94% on test set after 13 epochs. Thank you again for the time you have put into making everything so clear.
Hi! Thanks for the great video! Is there a way to integrate Gyroscope data together with Accelerometer data into the CNN in this video for Human Activity Recognition?
Great video. Is there any chance you could explain in more detail your steps for input 50 (under the 2D CNN model heading). I can’t quite understand it
Hi, this can be done in several ways. It is just a matter of preference. So this is just another way to do this. I am sure this lesson might have helped you. Thanks for watching ❤️.
output -variable are label encoded in multi-class classification and one hot encoded in multi-label classification. And always one hot encoded if it is input feature .
Hi, there are papers published on this topic which shows how effective it is. you can read this for better understanding of HAR mdpi-res.com/d_attachment/electronics/electronics-11-00322/article_deploy/electronics-11-00322-v2.pdf ieeexplore.ieee.org/document/7881728 iopscience.iop.org/article/10.1088/1757-899X/1031/1/012062/pdf
Hello KGP Talkie, Thanks for always being there for us. Please, I need the dataset use in this project. I checked the link and I was unable to download it and it is also not available on your Github account. Thanks and Appreciate.
save the standard scaler and label encoder objects into .pickle file or in .json and when u have new data get new instance from the saved file and preprocess the data and predict it . Hope it helps !
@@rohitsingh-wm1gv first get new data then call get frames func and use the returned data as ur feed data n if u r getting errors than check the shape of input data u r providing to the get frames func
@@kalppanwala6439 I have trained the model with my own data shape The test data has the same number of coloums except for the label I expect the trained model to tell me what the test data is Thats why i havent included it in the testdata
Really good tutorial! How can I add gyroscope and magnetometer data into the training data set? should I add them as if they are additional "channels" like RGB channels for images?
Can anyone pls tell me now how to use this build model. I have build this model successfully but how to give video input and how it will give output by predicting the Han action? Pls help
Hello, In this tutorial after frame preparation if I want to extract features like mean or standard deviation on this dataset then how will I proceed .please help me in this.
Hello sir, I would like to ask a few questions regarding this coding. def get_frames(df, frame_size, hop_size): N_FEATURES = 3 frames = [] labels = [] for i in range(0, len(df) - frame_size, hop_size): x = df['x'].values[i: i + frame_size] y = df['y'].values[i: i + frame_size] z = df['z'].values[i: i + frame_size]
# Retrieve the most often used label in this segment label = stats.mode(df['label'][i: i + frame_size])[0][0] frames.append([x, y, z]) labels.append(label) # Bring the segments into a better shape frames = np.asarray(frames).reshape(-1, frame_size, N_FEATURES) labels = np.asarray(labels) return frames, labels X, y = get_frames(scaled_X, frame_size, hop_size) X.shape, y.shape ((532, 80, 3), (532,)) 1. The first thing I would like to ask is, is the value 532 means that it groups the data to read the first 532 samples ? I am a bit lost at your explanation there. Let say if I want the code to read the first 356 lines of my data ? My sampling rate is 0.1Hz and each data is 10second. How would I code that ? 2. What if my sampling rate, Fs is a floating number ? (0.1Hz) I would get an error that says "'float' object cannot be interpreted as an integer". How do i fix that ?
I failed to predict a label with trained model file. And I found an error. You seem to train [x1, x2, x3], [x4,x5,x6]... instead of training [x1, y1, z1], [x2,y2,z2]... Now I get 89% of prediction of random data. I can give you error-corrected code if you want.
@@merzouklyza8800 Hi, I've managed to fix a code. Here's a solution: def get_frames(df, frame_size, hop_size): N_FEATURES = 3 # Number of features (x, y, z) frames = [] labels = [] for i in range(0, len(df) - frame_size, hop_size): x = df['x'].values[i: i + frame_size] y = df['y'].values[i: i + frame_size] z = df['z'].values[i: i + frame_size] # Retrieve the most often used label in this segment window_labels = df['label'][i: i + frame_size] if len(window_labels) > 0: mode_label = stats.mode(window_labels) try: label = mode_label.mode[0] except IndexError: label = df['label'][i] # Fallback to the first label in the frame if mode is empty or invalid else: label = df['label'][i] # Fallback if window_labels is empty frames.append([x, y, z]) labels.append(label) # Reshape frames into the desired shape frames = np.asarray(frames).reshape(-1, frame_size, N_FEATURES) labels = np.asarray(labels) return frames, labels X, y = get_frames(scaled_X, frame_size, hop_size) # Check the shapes print(X.shape, y.shape)
Sir can I deploy this project in my smartphone or any device ? Is it possible to link this code to any device for further data integrations. How to do it sir????
Maybe you can make a tutorial to test your model that is it exactly works in real implementation or not, maybe using android device to get accelero data, btw nice video keep it up!
Hi, This is in regard to the code file which you requested for different topics.I request you to please get enrolled yourself and show your support and love to KGP Talkie. All the code files and video lectures have lifetime access with 30 Days money back Guarantee. Code and question-answer support are also available at Udemy. Code files of UA-cam lectures will be also available once you register in this course. Please send an email to udemy@kgptalkie.com with your registration details of this course and a list of other code files that you want. I promise you to give FREE COUPONS for the next course on Deep Learning and ML. You can click on the link mentioned below and can get yourself enrolled!! bit.ly/udemy95off_kgptalkie New content is added at Udemy: 1. Animation Plot [2 lectures] 2. Python Coding in Mobile [5 lectures] 3. Complete EDA of Boston Dataset [20 lectures] What else we promise in this course 1. Kaggle data EDA 2. Text data EDA 3. More Animation Plot 4. More 3D plots 5. Figure Aesthetics and Decoration 6. Free coupons for next course 7. And so much more. Hurry up!!! Only for a limited time. Please email your details at udemy@kgptalkie.com for the FREE COUPONS of the next course.
Dear Sir, Greetings!! Thank you very much for outstanding implementation. I implemented same model on hospital data and getting 98%training accuracy but validation accuracy is very low 54%. I am requesting your guidance for same. Should I run 1 D CNN model over it? Or you suggest anything to achieve high validation accuracy using same model? . Thank you very much!
Dear Sir, Greetings!! Thank you very much for useful information. Can you please help me to know how to computer center of mass using left and right hand wrist gait data?
sir, loads of respect to you. u r a lifesaver. is it possible to contact you regarding my project on human activity recognition using Rnn, lstm and gru?
--------------------------------------------------------------------------- IndexError Traceback (most recent call last) Cell In[147], line 23 19 labels = np.asarray(labels) 21 return frames, labels ---> 23 X, y = get_frames(scaled_X, frame_size, hop_size) 25 X.shape, y.shape Cell In[147], line 13, in get_frames(df, frame_size, hop_size) 10 z = df['z'].values[i: i + frame_size] 12 # Retrieve the most often used label in this segment ---> 13 label = stats.mode(df['label'][i: i + frame_size])[0][0] 14 frames.append([x, y, z]) 15 labels.append(label) IndexError: invalid index to scalar variable. sir I am getting this error,help me sir
Hi, very nice article. Explained very clearly. Can you share the notebook link or the blog link. This link - kgptalkie.com/human-activity-recognition-using-accelerometer-data/ is not working
Thanks for putting this together, excellent clear introduction. I spent a little more time on the preprocessing of data and split the lines that had a missing newline so that there were two samples on each line and dealt with another couple of problems with the raw data. This resulted in about 3 times as much data over all (just over a million samples) and using your training model got an accuracy of 94% on test set after 13 epochs.
Thank you again for the time you have put into making everything so clear.
Thank you for these tutorials. Quite hard to find tf 2.0 videos right now, you are doing a great contribution
Thank you so much for watching. Please watch other videos and share those. Thank you.
You mentioned to get the links from the description but they are not here!
Brother Could you plz tell me how to use this trained model in real time?? I'm looking forward to hear from you. Thanks
Please share the architecture of the CNN model you have used
Sir the great. you are highly appreciate-able. I have no words to say thanks. Great lectures.
Can you please provide blog link
The link that you provided is not working
How can we fix "class_names = label.classes" in plot_confusion_matrix at 51:08 "labels = label.classes" doesn't work either
The frame segmentation method used, is that a sliding window or a fixed window technique.
Hello, thanks for this video. Would you suggest any videos on instance selection not feature selection?
but your github link is showing page not found error
It's very huge model. Reducing the size of x_train and x_test having no impact. What you suggest I do?
Sir after data preprocessing and train model then next how we detect human activity can you give code for demonstration of activity from video
Great Video, how can we make predictions considering the train data has been reshaped
you should finish the code with lines to release the GPU memory. For instance:
from numba import cuda
cuda.select_device(0)
cuda.close()
Thanks for pointing it out.
Great stuff, and thanks for putting this together.
Thankyou Sir,
Can you instruct how to use this model to make predictions?
Hi! Thanks for the great video! Is there a way to integrate Gyroscope data together with Accelerometer data into the CNN in this video for Human Activity Recognition?
This video helped me a lot can't thank enough!
Great video. Is there any chance you could explain in more detail your steps for input 50 (under the 2D CNN model heading). I can’t quite understand it
Another video has completed sir
I saw cleaning and understanding data very typical
Training data is very easy
Happy to know 😊
Hi...can you help me to do the same CNN in UCIHAR dataset?
Why is len(processedList) equals 343,416, when originally the number of examples is 1,098,207?
Thanks for the informative video. I tried to view your blog and code. But it's showing 503 error for past few days. Could u reupload the link.
@ KGP talkie -- Can you please mention the IEEE reference paper related to this video.
Where we can find code? Link given in discription is not opening
Thank you for these tutorials.
Dear sir,
Have you published any papers on this subject? I'd like to learn from it.
Can you please share the code for inference?
how can I test my custom data in this model?
Please share the notebook link.
the confusion matrix doesn't get printed in my case :(
Shouldnt this be done using OneHotEncoding instead of Label Encoding?
Hi, this can be done in several ways. It is just a matter of preference. So this is just another way to do this. I am sure this lesson might have helped you. Thanks for watching ❤️.
@@KGPTalkie yup. But for accuracy using the OHE instead of label encoding Is better. models tends to believe than a 2 or 3 is better than a 1.
@@jfabian bro im trying to using OHE
but im getting error
output -variable are label encoded in multi-class classification
and one hot encoded in multi-label classification.
And always one hot encoded if it is input feature .
Only if they were input variables.
Thank you, it was great, but the link to your code doesn't work.
Sir, is it Possible to get Good accuracy using Machine learning Models instead of Deep learning
Brilliant video!
I think there is no spatial relation in data, so why CNN ( convolution nn) ? You could have used fully connected nn.
Plz anyone answer.
Hi, there are papers published on this topic which shows how effective it is. you can read this for better understanding of HAR
mdpi-res.com/d_attachment/electronics/electronics-11-00322/article_deploy/electronics-11-00322-v2.pdf
ieeexplore.ieee.org/document/7881728
iopscience.iop.org/article/10.1088/1757-899X/1031/1/012062/pdf
I can't fine out data set link please give me data set link or say how to fine out data set ???
Thank you so much . Doing great work . Keep it up
please provide the data set of WISDM.....
we are unable to download it from original website
a veryyyyyyyyyyyyyyyyyy awesome tutorial
Hello KGP Talkie, Thanks for always being there for us. Please, I need the dataset use in this project. I checked the link and I was unable to download it and it is also not available on your Github account. Thanks and Appreciate.
Dataset Link: www.cis.fordham.edu/wisdm/dataset.php
can you provide github link of this project?
Good evening, thank you for your amazing video,
i want to ask you how shoudl i do to predict new data!?, it seems that i have problem.
thank you
save the standard scaler and label encoder objects into .pickle file or in .json and when u have new data get new instance from the saved file and preprocess the data and predict it .
Hope it helps !
Thanks for watching
@@kalppanwala6439 I dont understand, im getting errors when i import new data and apply get_frames functions
@@rohitsingh-wm1gv first get new data then call get frames func and use the returned data as ur feed data n if u r getting errors than check the shape of input data u r providing to the get frames func
@@kalppanwala6439 I have trained the model with my own data shape
The test data has the same number of coloums except for the label
I expect the trained model to tell me what the test data is
Thats why i havent included it in the testdata
Why did you use 2D CNN but not 1D?
great work. I really appreciate. very detailed and informative tutorial.
Thank you so much Yasin ❤️
what output show in this project
Really good tutorial!
How can I add gyroscope and magnetometer data into the training data set? should I add them as if they are additional "channels" like RGB channels for images?
Hey I'm trying to do the same too. I've two accelerometer data reading and not sure for to train the model.
Where do i find the notebook link?
Can anyone pls tell me now how to use this build model.
I have build this model successfully but how to give video input and how it will give output by predicting the Han action? Pls help
Hello, In this tutorial after frame preparation if I want to extract features like mean or standard deviation on this dataset then how will I proceed .please help me in this.
use np.mean()
@@KGPTalkie thanks for the reply
Can this be used to show a live demo of falling ???
Yes this can be used.
what if the dataset is in CSV format?
Sir, May I know why do you need to reshape the X_train to (425, 80, 3, 1) at 40:40 ? I'm confused about the '1' added there. Thanks!
Bcz of Conv2D needs 3dims data to its input.
Nice video bro, are you able to integrate the model into android as tflite? And how do you handle the input size for the model in android studio?
Hi can you help me to start this project ?!!
Hey sir
Can I test with my own personal data
I dont want it to predict
I want it to classify
Thanks for watching. Yes you can test it with your data. Use preexisting data for training then use your data for prediction.
KGP Talkie I’ll do that thanks
Thanks ❤️
How to test an unmarked data on your model?
Link code is broken buddy may u renew the link for code?
Hello sir, I would like to ask a few questions regarding this coding.
def get_frames(df, frame_size, hop_size):
N_FEATURES = 3
frames = []
labels = []
for i in range(0, len(df) - frame_size, hop_size):
x = df['x'].values[i: i + frame_size]
y = df['y'].values[i: i + frame_size]
z = df['z'].values[i: i + frame_size]
# Retrieve the most often used label in this segment
label = stats.mode(df['label'][i: i + frame_size])[0][0]
frames.append([x, y, z])
labels.append(label)
# Bring the segments into a better shape
frames = np.asarray(frames).reshape(-1, frame_size, N_FEATURES)
labels = np.asarray(labels)
return frames, labels
X, y = get_frames(scaled_X, frame_size, hop_size)
X.shape, y.shape
((532, 80, 3), (532,))
1. The first thing I would like to ask is, is the value 532 means that it groups the data to read the first 532 samples ? I am a bit lost at your explanation there. Let say if I want the code to read the first 356 lines of my data ? My sampling rate is 0.1Hz and each data is 10second. How would I code that ?
2. What if my sampling rate, Fs is a floating number ? (0.1Hz) I would get an error that says "'float' object cannot be interpreted as an integer". How do i fix that ?
bhai aapka github pe jo link hai vo khul hi nahi rahi hai repos delete kar diye hai kya??
Sir please make a video on brain tumor detection by using CNN
I will try it sure 😊😊😊
I failed to predict a label with trained model file. And I found an error. You seem to train [x1, x2, x3], [x4,x5,x6]... instead of training [x1, y1, z1], [x2,y2,z2]... Now I get 89% of prediction of random data. I can give you error-corrected code if you want.
Pls can u share it with me
@@merzouklyza8800 # start of original code in youtube
def get_frames(df, frame_size, hop_size):
N_FEATURES = 3
frames = []
labels = []
for i in range(0, len(df) - frame_size, hop_size):
x = df['x'].values[i: i+frame_size]
y = df['y'].values[i: i+frame_size]
z = df['z'].values[i: i+frame_size]
label = stats.mode(df['label'][i: i+frame_size])[0][0]
frames.append([x,y,z])
labels.append(label)
print('before reshape
', frames[0:10])
frames = np.asarray(frames).reshape(-1, frame_size, N_FEATURES)
print('after reshape
', frames[0:10])
labels = np.asarray(labels)
return frames, labels
# end of original code in youtube
# start of revised code
def get_frames(df, frame_size, hop_size):
N_FEATURES = 3
frames = []
labels = []
for i in range(0, len(df) - frame_size, hop_size):
x = df['x'].values[i: i+frame_size]
y = df['y'].values[i: i+frame_size]
z = df['z'].values[i: i+frame_size]
label = stats.mode(df['label'][i: i+frame_size])[0][0]
frames.append([x,y,z])
labels.append(label)
# hereafter added code
newframes = []
k = 0
m = 0
for k in range(532):
for m in range(80):
newframes.append([frames[k][0][m], frames[k][1][m], frames[k][2][m]])
print(len(newframes))
# end of added code
frames = np.asarray(newframes).reshape(-1, frame_size, N_FEATURES)
labels = np.asarray(labels)
return frames, labels
# end of revised code
Good job.
Your github link is not working. please check once
how to fix error on line 38
Are find a solution to fixe that plz ?
@@merzouklyza8800 Hi, I've managed to fix a code. Here's a solution:
def get_frames(df, frame_size, hop_size):
N_FEATURES = 3 # Number of features (x, y, z)
frames = []
labels = []
for i in range(0, len(df) - frame_size, hop_size):
x = df['x'].values[i: i + frame_size]
y = df['y'].values[i: i + frame_size]
z = df['z'].values[i: i + frame_size]
# Retrieve the most often used label in this segment
window_labels = df['label'][i: i + frame_size]
if len(window_labels) > 0:
mode_label = stats.mode(window_labels)
try:
label = mode_label.mode[0]
except IndexError:
label = df['label'][i] # Fallback to the first label in the frame if mode is empty or invalid
else:
label = df['label'][i] # Fallback if window_labels is empty
frames.append([x, y, z])
labels.append(label)
# Reshape frames into the desired shape
frames = np.asarray(frames).reshape(-1, frame_size, N_FEATURES)
labels = np.asarray(labels)
return frames, labels
X, y = get_frames(scaled_X, frame_size, hop_size)
# Check the shapes
print(X.shape, y.shape)
Great work.
Sir can I deploy this project in my smartphone or any device ?
Is it possible to link this code to any device for further data integrations.
How to do it sir????
Yes you can deploy it. Integrate it with Android Apps.
@@KGPTalkieUsing Android Studio ?
How to do it sir any video link or website help???
This Is my final yr project and I don't know how to do it
Well. Of course you need to first make some Android Apps. Search on UA-cam you will get lots of good resources.
@@KGPTalkieThankyou so much sir !!!
Brother can you share your github link for your code
Maybe you can make a tutorial to test your model that is it exactly works in real implementation or not, maybe using android device to get accelero data, btw nice video keep it up!
Thank you.
u used fit_transform but u mention previously it needs to be done for training u are doing it for full dataset why?
sorry i got it but why did u used 2d instead of 1d when data was not image
@@nakulamate3558 Data is 2D.. It has components in x, y and z. Its why he applied a reshape
Sir GitHub link for downloading file is not working please provide.
Hi,
This is in regard to the code file which you requested for different topics.I request you to please get enrolled yourself and show your support and love to KGP Talkie. All the code files and video lectures have lifetime access with 30 Days money back Guarantee. Code and question-answer support are also available at Udemy.
Code files of UA-cam lectures will be also available once you register in this course. Please send an email to udemy@kgptalkie.com with your registration details of this course and a list of other code files that you want.
I promise you to give FREE COUPONS for the next course on Deep Learning and ML. You can click on the link mentioned below and can get yourself enrolled!! bit.ly/udemy95off_kgptalkie
New content is added at Udemy:
1. Animation Plot [2 lectures]
2. Python Coding in Mobile [5 lectures]
3. Complete EDA of Boston Dataset [20 lectures]
What else we promise in this course
1. Kaggle data EDA
2. Text data EDA
3. More Animation Plot
4. More 3D plots
5. Figure Aesthetics and Decoration
6. Free coupons for next course
7. And so much more.
Hurry up!!! Only for a limited time.
Please email your details at udemy@kgptalkie.com for the FREE COUPONS of the next course.
sir, please make tutorials on detect accelerometer data using an android device
Code is missing in github
video starts at 2:00
Why have you used CNN and not RNN ?
I need base paper for u explained.
Very helpful
Thanks
make video on flowers recognigation
I am really excited to make one on flower plant recognition. I will make one soon. Thanks for watching.
Dear Sir,
Greetings!!
Thank you very much for outstanding implementation. I implemented same model on hospital data and getting 98%training accuracy but validation accuracy is very low 54%. I am requesting your guidance for same. Should I run 1 D CNN model over it? Or you suggest anything to achieve high validation accuracy using same model? .
Thank you very much!
Dear Sir,
Greetings!!
Thank you very much for useful information. Can you please help me to know how to computer center of mass using left and right hand wrist gait data?
Where are the code links?
Please follow along the video. Due to some technical issue codes are not available.
@@KGPTalkie Okay. It's a nice way to analyse this type of data without understanding about signal processing
sir, loads of respect to you. u r a lifesaver. is it possible to contact you regarding my project on human activity recognition using Rnn, lstm and gru?
Thanks for watching ❤️ 😍. Currently I am on leave.
mam i have error
I HAVE SOLVED MAM
---------------------------------------------------------------------------
IndexError Traceback (most recent call last)
Cell In[147], line 23
19 labels = np.asarray(labels)
21 return frames, labels
---> 23 X, y = get_frames(scaled_X, frame_size, hop_size)
25 X.shape, y.shape
Cell In[147], line 13, in get_frames(df, frame_size, hop_size)
10 z = df['z'].values[i: i + frame_size]
12 # Retrieve the most often used label in this segment
---> 13 label = stats.mode(df['label'][i: i + frame_size])[0][0]
14 frames.append([x, y, z])
15 labels.append(label)
IndexError: invalid index to scalar variable.
sir I am getting this error,help me sir
Hi, very nice article. Explained very clearly. Can you share the notebook link or the blog link. This link - kgptalkie.com/human-activity-recognition-using-accelerometer-data/
is not working
Great video, really helpful, thanks!