deepethogram icon indicating copy to clipboard operation
deepethogram copied to clipboard

Flow generator must be greater than one issue on Colab

Open felipe-parodi opened this issue 3 years ago • 2 comments

Hello,

Running DeepEtho on colab and encountered an issue when running inference with the feature extractor. The flow generator and feature extractor trained just fine. Here's the output:

`[2022-06-07 11:02:42,603] INFO [deepethogram.projects.convert_config_paths_to_absolute:1135] cwd in absolute: /content/drive/.shortcut-targets-by-id/1kut2K2H4KJzoLtQDQw0aEwgz1sNDm1iK/EggLay_deepethogram/models/220607_110218_feature_extractor_train [2022-06-07 11:02:42,609] INFO [deepethogram.projects.convert_config_paths_to_absolute:1178] after absolute: {'class_names': ['background', 'per', 'bend', 'burrow', 'drag', 'groom', 'egg'], 'config_file': '/content/drive/MyDrive/CajalQaB/EggLay_deepethogram/project_config.yaml', 'data_path': '/content/drive/MyDrive/CajalQaB/EggLay_deepethogram/DATA', 'labeler': None, 'model_path': '/content/drive/MyDrive/CajalQaB/EggLay_deepethogram/models', 'name': 'EggLay', 'path': '/content/drive/MyDrive/CajalQaB/EggLay_deepethogram', 'pretrained_path': '/content/drive/MyDrive/CajalQaB/EggLay_deepethogram/models/pretrained_models'} [2022-06-07 11:02:42,631] INFO [deepethogram.feature_extractor.inference.feature_extractor_inference:473] args: /usr/local/lib/python3.7/dist-packages/ipykernel_launcher.py -f /root/.local/share/jupyter/runtime/kernel-e79915f1-c015-4919-8ffa-64edae425a9d.json [2022-06-07 11:02:42,633] INFO [deepethogram.feature_extractor.inference.feature_extractor_inference:475] configuration used in inference: [2022-06-07 11:02:42,648] INFO [deepethogram.feature_extractor.inference.feature_extractor_inference:476] split: reload: true file: null train_val_test:

  • 0.8
  • 0.2
  • 0.0 compute: fp16: false num_workers: 2 batch_size: 32 min_batch_size: 8 max_batch_size: 512 distributed: false gpu_id: 0 dali: false metrics_workers: 0 reload: overwrite_cfg: false latest: false notes: null log: level: info augs: brightness: 0.25 contrast: 0.1 hue: 0.1 saturation: 0.1 color_p: 0.5 grayscale: 0.5 crop_size: null resize:
  • 224
  • 224 dali: false random_resize: false pad: null LR: 0.5 UD: 0.0 degrees: 10 normalization: 'N': 270317520 mean:
    • 0.6266480327776516
    • 0.6266480327776516
    • 0.6266480327776516 std:
    • 0.14578843279585693
    • 0.14578843279585693
    • 0.14578843279585693 feature_extractor: arch: resnet18 fusion: average sampler: null final_bn: false sampling_ratio: null final_activation: sigmoid dropout_p: 0.25 n_flows: 10 n_rgb: 1 curriculum: false inputs: both weights: latest n_flow: 10 train: steps_per_epoch: train: 1000 val: 200 test: 20 num_epochs: 10 loss_weight_exp: 1.0 flow_generator: type: flow_generator flow_loss: MotionNet flow_max: 10 input_images: 11 flow_sparsity: false smooth_weight_multiplier: 1.0 sparsity_weight: 0.0 loss: MotionNet max: 5 n_rgb: 11 arch: TinyMotionNet weights: latest 'n': 10 inference: directory_list: all ignore_error: false overwrite: true use_loaded_model_cfg: true postprocessor: type: min_bout_per_behavior min_bout_length: 1 cmap: deepethogram control_arrow_jump: 31 label_view_width: 31 prediction_opacity: 0.2 project: class_names:
  • background
  • per
  • bend
  • burrow
  • drag
  • groom
  • egg config_file: /content/drive/MyDrive/CajalQaB/EggLay_deepethogram/project_config.yaml data_path: /content/drive/MyDrive/CajalQaB/EggLay_deepethogram/DATA labeler: null model_path: /content/drive/MyDrive/CajalQaB/EggLay_deepethogram/models name: EggLay path: /content/drive/MyDrive/CajalQaB/EggLay_deepethogram pretrained_path: /content/drive/MyDrive/CajalQaB/EggLay_deepethogram/models/pretrained_models run: type: inference model: feature_extractor dir: /content/drive/MyDrive/CajalQaB/EggLay_deepethogram/models/220607_110242_feature_extractor_inference sequence: filter_length: 15 unlabeled_alpha: 0.1 vertical_arrow_jump: 3

[2022-06-07 11:02:42,651] INFO [deepethogram.feature_extractor.inference.feature_extractor_inference:481] Latent name used in HDF5 file: resnet18

AssertionError Traceback (most recent call last) in () ----> 1 feature_extractor_inference(cfg)

/usr/local/lib/python3.7/dist-packages/deepethogram/feature_extractor/inference.py in feature_extractor_inference(cfg) 503 assert os.path.isdir(directory), 'Not a directory: {}'.format(directory) 504 record = projects.get_record_from_subdir(directory) --> 505 assert record['rgb'] is not None 506 records.append(record) 507 assert cfg.feature_extractor.n_flows + 1 == cfg.flow_generator.n_rgb, 'Flow generator inputs must be one greater ' \

AssertionError:`

What could this be? already tried restarted the runtime. Thanks in advance!

felipe-parodi avatar Jun 07 '22 11:06 felipe-parodi

Hello,

I just re-ran the Colab with the latest version of DeepEthogram. All works well for me.

In the cfg file in your logs above, the cfg.feature_extractor.n_flows is equal to 10, and cfg.flow_generator.n_rgb is equal to 11. I'm not sure how this is happening for you.

Before you run inference, can you just run this line in your notebook: print(OmegaConf.to_yaml(cfg))

jbohnslav avatar Jun 08 '22 01:06 jbohnslav

Hi Jim! I confirmed cfg.feature_extractor.n_flows == 10 and cfg.flow_generator.n_rgb == 11. I now get an Assertion error: deepethoassert

felipe-parodi avatar Jun 08 '22 12:06 felipe-parodi