train/models/slip_detect.py [17:64]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        self.criterion = nn.CrossEntropyLoss()

        self.train_accuracy = torchmetrics.Accuracy()
        self.val_accuracy = torchmetrics.Accuracy()

    def forward(self, frame):
        return self.model(frame)

    def training_step(self, batch, batch_idx):
        images, targets, sn = batch
        output = self.forward(images)
        train_loss = self.criterion(output, targets)

        self.log(
            "train_loss",
            train_loss,
            on_step=True,
            on_epoch=True,
            prog_bar=True,
            logger=True,
        )
        return train_loss

    def validation_step(self, batch, batch_idx):
        images, targets, sn = batch
        output = self.forward(images)
        val_loss = self.criterion(output, targets)

        self.val_accuracy(output.argmax(dim=1), targets)

        self.log(
            "val_loss",
            val_loss,
            on_epoch=True,
            on_step=False,
            prog_bar=True,
            logger=True,
        )
        self.log(
            "val_acc",
            self.val_accuracy,
            on_epoch=True,
            on_step=False,
            prog_bar=True,
            logger=True,
        )

    def configure_optimizers(self):
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



train/models/touch_detect.py [23:70]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        self.criterion = nn.CrossEntropyLoss()

        self.train_accuracy = torchmetrics.Accuracy()
        self.val_accuracy = torchmetrics.Accuracy()

    def forward(self, frame):
        return self.model(frame)

    def training_step(self, batch, batch_idx):
        images, targets, sn = batch
        output = self.forward(images)
        train_loss = self.criterion(output, targets)

        self.log(
            "train_loss",
            train_loss,
            on_step=True,
            on_epoch=True,
            prog_bar=True,
            logger=True,
        )
        return train_loss

    def validation_step(self, batch, batch_idx):
        images, targets, sn = batch
        output = self.forward(images)
        val_loss = self.criterion(output, targets)

        self.val_accuracy(output.argmax(dim=1), targets)

        self.log(
            "val_loss",
            val_loss,
            on_epoch=True,
            on_step=False,
            prog_bar=True,
            logger=True,
        )
        self.log(
            "val_acc",
            self.val_accuracy,
            on_epoch=True,
            on_step=False,
            prog_bar=True,
            logger=True,
        )

    def configure_optimizers(self):
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



