Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

about json file, the input size and crop size should based on what #43

Closed
ShiMinghao0208 opened this issue Nov 7, 2020 · 12 comments
Closed

Comments

@ShiMinghao0208
Copy link

ShiMinghao0208 commented Nov 7, 2020

my dataset image size is 256*256,and i dont know how to modifiy the json file

{
    "dataset": "BDCI",
    "method": "fcn_segmentor",
    "data": {
      "image_tool": "cv2",
      "input_mode": "BGR",
      "num_classes": 7,
      "label_list": [0, 1, 2, 3, 4, 5, 6, 255],
      "data_dir": "~/DataSet/BDCI",
      "workers": 8
    },
   "train": {
      "batch_size": 16,
      "data_transformer": {
        "size_mode": "fix_size",
        "input_size": [256, 256],
        "align_method": "only_pad",
        "pad_mode": "random"
      }
    },
    "val": {
      "batch_size": 4,
      "mode": "ss_test",
      "data_transformer": {
        "size_mode": "fix_size",
        "input_size": [256, 256],
        "align_method": "only_pad"
      }
    },
    "test": {
      "batch_size": 4,
      "mode": "ss_test",
      "out_dir": "~/DataSet/BDCI/seg_result/BDCI",
      "data_transformer": {
        "size_mode": "fix_size",
        "input_size": [256, 256],
        "align_method": "only_pad"
      }
    },
    "train_trans": {
      "trans_seq": ["random_resize", "random_crop", "random_hflip", "random_brightness"],
      "random_brightness": {
        "ratio": 1.0,
        "shift_value": 10
      },
      "random_hflip": {
        "ratio": 0.5,
        "swap_pair": []
      },
      "random_resize": {
        "ratio": 1.0,
        "method": "random",
        "scale_range": [0.5, 2.0],
        "aspect_range": [0.9, 1.1]
      },
      "random_crop":{
        "ratio": 1.0,
        "crop_size": [256, 256],
        "method": "random",
        "allow_outside_center": false
      }
    },
    "val_trans": {
      "trans_seq": []
    },
    "normalize": {
      "div_value": 255.0,
      "mean_value": [0.485, 0.456, 0.406],
      "mean": [0.485, 0.456, 0.406],
      "std": [0.229, 0.224, 0.225]
    },
    "checkpoints": {
      "checkpoints_name": "fs_baseocnet_BDCI_seg",
      "checkpoints_dir": "./checkpoints/BDCI",
      "save_iters": 500
    },
    "network":{
      "backbone": "deepbase_resnet101_dilated8",
      "multi_grid": [1, 1, 1],
      "model_name": "base_ocnet",
      "bn_type": "inplace_abn",
      "stride": 8,
      "factors": [[8, 8]],
      "loss_weights": {
        "corr_loss": 0.01,
        "aux_loss": 0.4,
        "seg_loss": 1.0
      }
    },
    "logging": {
      "logfile_level": "info",
      "stdout_level": "info",
      "log_file": "./log/BDCI/fs_baseocnet_BDCI_seg.log",
      "log_format": "%(asctime)s %(levelname)-7s %(message)s",
      "rewrite": true
    },
    "lr": {
      "base_lr": 0.01,
      "metric": "iters",
      "lr_policy": "lambda_poly",
      "step": {
        "gamma": 0.5,
        "step_size": 100
      }
    },
    "solver": {
      "display_iter": 10,
      "test_interval": 1000,
      "max_iters": 40000
    },
    "optim": {
      "optim_method": "sgd",
      "adam": {
        "betas": [0.9, 0.999],
        "eps": 1e-08,
        "weight_decay": 0.0001
      },
      "sgd": {
        "weight_decay": 0.0005,
        "momentum": 0.9,
        "nesterov": false
      }
    },
    "loss": {
      "loss_type": "fs_auxce_loss",
      "params": {
        "ce_weight": [0.8373, 0.9180, 0.8660, 1.0345, 1.0166, 0.9969, 0.9754,
                      1.0489, 0.8786, 1.0023, 0.9539, 0.9843, 1.1116, 0.9037,
                      1.0865, 1.0955, 1.0865, 1.1529, 1.0507],
        "ce_reduction": "elementwise_mean",
        "ce_ignore_index": -1,
        "ohem_minkeep": 100000,
        "ohem_thresh": 0.9
      }
    }
}

here is my json file, and when i try to train my dataset, there is such sizemisbatch error...like:
image
image
and so on,
environment should be satisfied:
image

this is my val error:
image
and the config.profile:
image
this is my log file screenshot:
image
image
image
image

@hsfzxjy
Copy link
Contributor

hsfzxjy commented Nov 11, 2020

@ShiMinghao0208 Hi. Seems that you are using HRNet-W48 as backbone model, but trying to load pretrained weights of HRNet-W32.

@ShiMinghao0208
Copy link
Author

@ShiMinghao0208 Hi. Seems that you are using HRNet-W48 as backbone model, but trying to load pretrained weights of HRNet-W32.

Oh,I think one model can use several different pre-training models. I change the HRNet-W48 pretrained model, it does work. Very thank u.

@hsfzxjy
Copy link
Contributor

hsfzxjy commented Nov 11, 2020

They have different structure and thus the weights could not be shared.

@ShiMinghao0208
Copy link
Author

They have different structure and thus the weights could not be shared.

ok,thanks. I will try other model,too. I am very sorry to bother u.

@ShiMinghao0208
Copy link
Author

They have different structure and thus the weights could not be shared.

I want to try to use script val 1 after my training process,but I get a error about file dir error. The training process is normal,and I check my DATA_ROOT, I dont know why I get this error

@hsfzxjy
Copy link
Contributor

hsfzxjy commented Nov 20, 2020

They have different structure and thus the weights could not be shared.

I want to try to use script val 1 after my training process,but I get a error about file dir error. The training process is normal,and I check my DATA_ROOT, I dont know why I get this error

Could you share the training log? So that we could help figure out the problem.

@ShiMinghao0208
Copy link
Author

They have different structure and thus the weights could not be shared.

I want to try to use script val 1 after my training process,but I get a error about file dir error. The training process is normal,and I check my DATA_ROOT, I dont know why I get this error

Could you share the training log? So that we could help figure out the problem.

They have different structure and thus the weights could not be shared.

I want to try to use script val 1 after my training process,but I get a error about file dir error. The training process is normal,and I check my DATA_ROOT, I dont know why I get this error

Could you share the training log? So that we could help figure out the problem.

OK, thank u very much. I upload the screenshot about my log and question in the issue.Does that help solve the problem?

@hsfzxjy
Copy link
Contributor

hsfzxjy commented Nov 20, 2020

Could you provide the script file (the .sh file) you are using? You may upload the file by attaching it to a comment. I guess there should be some mistakes in the validation command.

@ShiMinghao0208
Copy link
Author

json_log_sh.zip

@ShiMinghao0208
Copy link
Author

Could you provide the script file (the .sh file) you are using? You may upload the file by attaching it to a comment. I guess there should be some mistakes in the validation command.

OK, I upload the zip of my file(sh, json and so on).

@hsfzxjy
Copy link
Contributor

hsfzxjy commented Nov 20, 2020

Hi. You should add extra arguments --data_dir ${DATA_DIR} to the command, i.e., change it into:

${PYTHON} -u main.py --configs ${CONFIGS} --drop_last y \
                       --backbone ${BACKBONE} --model_name ${MODEL_NAME} --checkpoints_name ${CHECKPOINTS_NAME} \
                       --phase test --gpu 0 1 2 --resume ./checkpoints/BDCI/${CHECKPOINTS_NAME}_latest.pth \
                       --loss_type ${LOSS_TYPE} --test_dir ${DATA_DIR}/val/image \
                       --out_dir ${SAVE_DIR}${CHECKPOINTS_NAME}_val \
                       --data_dir ${DATA_DIR}

@ShiMinghao0208
Copy link
Author

Hi. You should add extra arguments --data_dir ${DATA_DIR} to the command, i.e., change it into:

${PYTHON} -u main.py --configs ${CONFIGS} --drop_last y \
                       --backbone ${BACKBONE} --model_name ${MODEL_NAME} --checkpoints_name ${CHECKPOINTS_NAME} \
                       --phase test --gpu 0 1 2 --resume ./checkpoints/BDCI/${CHECKPOINTS_NAME}_latest.pth \
                       --loss_type ${LOSS_TYPE} --test_dir ${DATA_DIR}/val/image \
                       --out_dir ${SAVE_DIR}${CHECKPOINTS_NAME}_val \
                       --data_dir ${DATA_DIR}

OK,thanks very much. I will try it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants