Skip to content

Instantly share code, notes, and snippets.

View mbed92's full-sized avatar
😎

Michał Bednarek mbed92

😎
View GitHub Profile
@mbed92
mbed92 / soft_grip_repo_supplement.py
Last active September 23, 2023 10:15
[PhD Reviews] This code serves the purpose of extending experiments performed during a PhD study. Its primary focus is on designing and training a fully connected neural network (FC) using the PyTorch framework. The task involves regression of the stiffness parameter using data collected from an IMUs attached to a 2-finger gripper.
import os
import pickle
import numpy as np
import torch
import torch.nn as nn
from sklearn.model_selection import KFold
from torch.utils.data import Dataset, DataLoader
from torch.utils.tensorboard import SummaryWriter
from torchsummary import summary
from statemachine import StateMachine, State, Transition
# define states for a master (way of passing args to class)
options = [
{"name": "IDLE", "initial": True, "value": "idle"}, # 0
{"name": "A", "initial": False, "value": "a"}, # 1
{"name": "B", "initial": False, "value": "b"}, # 2
{"name": "C", "initial": False, "value": "c"}, # 3
{"name": "F", "initial": False, "value": "f"}] # 4