• 大小: 41KB
    文件类型: .zip
    金币: 2
    下载: 0 次
    发布日期: 2024-01-31
  • 语言: Python
  • 标签: 深度学习  

资源简介

深度学习视频中的行为识别分享,采用python语言编写,真实可靠,好用
深度学习视频中的行为识别分享,采用python语言编写,真实可靠,好用

资源截图

代码片段和文件信息

# coding:utf8
from __future__ import division
from __future__ import print_function

from config import cfg
from opts import parse_opts

import os
import torch
from torch import nn
from torch.optim import lr_scheduler
from datasets import FaceRecognition train_spatial_transform \
    TemporalRandomCrop val_spatial_transform
from tensorboard_logger import Logger
from log_utils import get_log_dir
from train import train_epoch
from validation import val_epoch
from models import get_model


def main():
    opt = parse_opts()

    ecd_name cls_name = opt.model_name.split(‘-‘)

    cfg.encoder_model = ecd_name
    cfg.classification_model = cls_name

    if opt.debug:
        cfg.debug = opt.debug
    else:
        if opt.tensorboard == ‘TEST‘:
            cfg.tensorboard = opt.model_name
        else:
            cfg.tensorboard = opt.tensorboard
            cfg.flag = opt.flag

    model parameters = get_model(2)
    cfg.video_path = os.path.join(cfg.root_path cfg.video_path)
    cfg.annotation_path = os.path.join(cfg.root_path cfg.annotation_path)

    cfg.list_all_member()

    torch.manual_seed(cfg.manual_seed)
    print(‘##########################################‘)
    print(‘####### model 仅支持单GPU‘)
    print(‘##########################################‘)
    print(model)
    criterion = nn.CrossEntropyLoss()
    if cfg.cuda:
        criterion = criterion.cuda()

    print(‘##########################################‘)
    print(‘####### train‘)
    print(‘##########################################‘)

    training_data = FaceRecognition(cfg
                                    ‘/share5/public/lijianwei/faces/‘
                                    TemporalRandomCrop(14)
                                    train_spatial_transform)
    train_loader = torch.utils.data.DataLoader(
        training_data
        batch_size=cfg.batch_size
        shuffle=True
        num_workers=cfg.n_threads
        drop_last=False
        pin_memory=True)
    optimizer = torch.optim.SGD(
        parameters
        lr=cfg.lr
        momentum=0.9
        dampening=0.9
        weight_decay=1e-3)
    scheduler = lr_scheduler.ReduceLROnPlateau(
        optimizer ‘min‘ patience=cfg.lr_patience)
    print(‘##########################################‘)
    print(‘####### val‘)
    print(‘##########################################‘)
    validation_data = FaceRecognition(cfg
                                      ‘/share5/public/lijianwei/faces/‘
                                      TemporalRandomCrop(14)
                                      val_spatial_transform
                                      phase=‘val‘)
    val_loader = torch.utils.data.DataLoader(
        validation_data
        batch_size=cfg.batch_size
        shuffle=False
        num_workers=cfg.n_threads
        drop_last=False
        pin_memory=True)
    print(‘##########################################‘)
    print(‘####### run‘)
    print(‘##########################################‘)

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2018-07-07 09:02  Mo-action-recognition-master\
     文件          43  2018-07-07 09:02  Mo-action-recognition-master\README.md
     文件        3499  2018-07-07 09:02  Mo-action-recognition-master\baseline_main.py
     文件        2998  2018-07-07 09:02  Mo-action-recognition-master\config.py
     文件        1543  2018-07-07 09:02  Mo-action-recognition-master\dataset.py
     目录           0  2018-07-07 09:02  Mo-action-recognition-master\datasets\
     文件         168  2018-07-07 09:02  Mo-action-recognition-master\datasets\__init__.py
     文件        2968  2018-07-07 09:02  Mo-action-recognition-master\datasets\faceRecognition.py
     文件        6569  2018-07-07 09:02  Mo-action-recognition-master\datasets\face_transforms.py
     文件        7034  2018-07-07 09:02  Mo-action-recognition-master\datasets\ucf101.py
     文件         282  2018-07-07 09:02  Mo-action-recognition-master\log_utils.py
     文件        4503  2018-07-07 09:02  Mo-action-recognition-master\main.py
     文件        4388  2018-07-07 09:02  Mo-action-recognition-master\main_log.py
     文件        2756  2018-07-07 09:02  Mo-action-recognition-master\main_test.py
     文件         635  2018-07-07 09:02  Mo-action-recognition-master\mean.py
     目录           0  2018-07-07 09:02  Mo-action-recognition-master\models\
     文件        2125  2018-07-07 09:02  Mo-action-recognition-master\models\BasicModule.py
     文件         713  2018-07-07 09:02  Mo-action-recognition-master\models\CNNencoder.py
     文件         198  2018-07-07 09:02  Mo-action-recognition-master\models\__init__.py
     文件         872  2018-07-07 09:02  Mo-action-recognition-master\models\attentionlayer.py
     文件       11502  2018-07-07 09:02  Mo-action-recognition-master\models\inceptionv4.py
     文件        4012  2018-07-07 09:02  Mo-action-recognition-master\models\mobilev2.py
     文件         937  2018-07-07 09:02  Mo-action-recognition-master\models\models_factory.py
     文件        6493  2018-07-07 09:02  Mo-action-recognition-master\models\resnet.py
     文件        8275  2018-07-07 09:02  Mo-action-recognition-master\models\resnet3D.py
     文件        2344  2018-07-07 09:02  Mo-action-recognition-master\models\vedioLSTM.py
     文件        6265  2018-07-07 09:02  Mo-action-recognition-master\models\vgg.py
     文件        2194  2018-07-07 09:02  Mo-action-recognition-master\models\videoGRU.py
     文件         978  2018-07-07 09:02  Mo-action-recognition-master\opts.py
     文件        3643  2018-07-07 09:02  Mo-action-recognition-master\rnn_main.py
     文件         104  2018-07-07 09:02  Mo-action-recognition-master\run.sh
............此处省略13个文件信息

评论

共有 条评论