Giter Club home page Giter Club logo

sensor-based-human-activity-recognition-deepconvlstm-pytorch's People

Contributors

dspanah avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

sensor-based-human-activity-recognition-deepconvlstm-pytorch's Issues

Conversion of Conv LSTM to CNN model

Hi,
I want to convert your code to CNN model. I modified the model as:
class HARModel(nn.Module):

def __init__(self, n_hidden=128, n_layers=1, n_filters=64, 
             n_classes=18, filter_size=3, drop_prob=0.6):
    super(HARModel, self).__init__()
    self.drop_prob = drop_prob
    self.n_layers = n_layers
    self.n_hidden = n_hidden
    self.n_filters = n_filters
    self.n_classes = n_classes
    self.filter_size = filter_size
         
    self.conv1 = nn.Conv1d(NB_SENSOR_CHANNELS, n_filters, filter_size)
    self.conv2 = nn.Conv1d(n_filters, n_filters, filter_size)
    self.conv3 = nn.Conv1d(n_filters, n_filters, filter_size)
    
    self.fc1 = nn.Linear(n_filters*filter_size,n_hidden)
    self.fc2 = nn.Linear(n_hidden, n_classes)

    self.dropout = nn.Dropout(drop_prob)

def forward(self, x, hidden, batch_size):
    
    x = x.view(-1, NB_SENSOR_CHANNELS, SLIDING_WINDOW_LENGTH)
    x = F.relu(F.max_pool1d(self.conv1(x),2))
    x = F.relu(F.max_pool1d(self.conv2(x),2))
    x = F.relu(F.max_pool1d(self.conv3(x),2))
    
    x = x.contiguous().view(-1, self.n_hidden)
    x = self.dropout(x)
    x = self.fc1(x)
    x = self.fc2(x)
    
    out = x.view(batch_size, -1, self.n_classes)[:,-1,:]
    
    return out, hidden

It gives me the following error after running the code:
size mismatch, m1: [50 x 128], m2: [192 x 128] at C:\w\1\s\tmp_conda_3.7_105232\conda\conda-bld\pytorch_1579085620499\work\aten\src\TH/generic/THTensorMath.cpp:136
Please suggest how I can modify your code for developing CNN model.

trained result error

I trained to the code 500 times with lr 0.001 and the result is always below
Epoch: 289/500...Train Loss: 0.1521...Val Loss: 0.7511...Val Acc: 0.8145...F1-Score: 0.8155...

Epoch: 348/500... Train Loss: 0.1344... Val Loss: 0.8809... Val Acc: 0.8039... F1-Score: 0.8052...
Epoch: 349/500... Train Loss: 0.1328... Val Loss: 0.7956... Val Acc: 0.8001... F1-Score: 0.7997...
Epoch: 350/500... Train Loss: 0.1355... Val Loss: 0.8102... Val Acc: 0.8029... F1-Score: 0.8047...

update to PAMAP2 dataset

Hey, When will you add PAMAP2 dataset to train, I found some papers that have published the accuracy of your model on the PAMAP2 dataset. How did they get this? Thank you.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.