Skip to content

Latest commit

 

History

History

resnext50_32x4d

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

ResNext50_32x4d

Train on imagenette Dataset

Prepare Traning Data And Pretrain Models

Download Ofrecord

wget https://oneflow-public.oss-cn-beijing.aliyuncs.com/datasets/imagenette_ofrecord.tar.gz
tar zxf imagenette_ofrecord.tar.gz

Download Pretrain Models

wget https://oneflow-public.oss-cn-beijing.aliyuncs.com/model_zoo/cv/classification/resnext50_32x4d/resnext50_32x4d_oneflow_model.tar.gz

Run Oneflow Training script

bash train.sh

Inference on Single Image

bash infer.sh

Util

convert pytorch pretrained model to oneflow pretrained model

wget https://download.pytorch.org/models/resnext50_32x4d-7cdf4587.pth
import torch
import oneflow as flow 
from models.resnext50_32x4d import resnext50_32x4d

parameters = torch.load("resnext50_32x4d-7cdf4587.pth")
new_parameters = dict()
for key,value in parameters.items():
     if "num_batches_tracked" not in key:
          val = value.detach().cpu().numpy()
          new_parameters[key] = val




resnext50_32x4d_module = resnext50_32x4d()
resnext50_32x4d_module.load_state_dict(new_parameters)
flow.save(resnext50_32x4d_module.state_dict(), "resnext50_32x4d_oneflow_model")