Giter Site home page Giter Site logo

Train model about patrecon HOT 3 CLOSED

zhouzhenghong-gt avatar zhouzhenghong-gt commented on September 14, 2024
Train model

from patrecon.

Comments (3)

Sungden avatar Sungden commented on September 14, 2024

Hi! this is a great paper! and I want to ask how to use trainer.py to train the model?

Hello, Do you know how to train the model yet? Thanks.

from patrecon.

sainatarajan avatar sainatarajan commented on September 14, 2024

@Sungden If you're still working on this, the below code should help you get a start

import torch
import torch.nn as nn
import argparse

from torchsummary import summary
from net import *
from trainer import Trainer_ReconNet
from data import MyReconDataset # Your dataset class

import os
# os.environ['KMP_DUPLICATE_LIB_OK'] = 'True'

###########################
########ARGUMENTS##########

parser = argparse.ArgumentParser(description='A test program.')

parser.add_argument("--exp", default='exp1', help="test1")
parser.add_argument("--arch", default='ReconNet', help="test1")
parser.add_argument("--print_freq", default=2, help="test1")
parser.add_argument("--output_path", default='output/', help="test1")
parser.add_argument("--resume", default=False, help="test1")
parser.add_argument("--loss", default='l2', help="test1")
parser.add_argument("--optim", default='adam', help="test1")
parser.add_argument("--lr", default=1e-4, help="test1")
parser.add_argument("--weight_decay", default=0.99, help="test1")

args = parser.parse_args()

###########################

device = torch.device('cuda:0' if torch.cuda.is_available() else 'cpu')

trainer_obj = Trainer_ReconNet(args)

root_path = '/path/to/your/dataset'
train_dataset = MyReconDataset(root_path + '/images/*.png', root_path + '/volumes/*.nii.gz')
train_dataloader = torch.utils.data.DataLoader(train_dataset, batch_size=1)

for epoch in range(5):
    print('Epoch:', epoch+1)

    trainer_obj.train_epoch(train_dataloader, epoch + 1)

from patrecon.

yinyin-llll avatar yinyin-llll commented on September 14, 2024

hi,i also want to retrain the model but it need the csv file with annotation.Do you know this file or how to design this file?
Thank you very much!

from patrecon.

Related Issues (10)

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.