Can't evaluate pruned model for FasterRCNN

Hi, I’m trying to evaluate my prune model with FasterRCNN (Jupyter examples), but I encounter the following error:

Traceback (most recent call last):
  File "/home/vpraveen/.cache/dazel/_dazel_vpraveen/216c8b41e526c3295d3b802489ac2034/execroot/ai_infra/bazel-out/k8-fastbuild/bin/magnet/packages/iva/build_wheel.runfiles/ai_infra/iva/faster_rcnn/scripts/evaluate.py", line 163, in <module>
  File "/home/vpraveen/.cache/dazel/_dazel_vpraveen/216c8b41e526c3295d3b802489ac2034/execroot/ai_infra/bazel-out/k8-fastbuild/bin/magnet/packages/iva/build_wheel.runfiles/ai_infra/iva/faster_rcnn/scripts/evaluate.py", line 70, in main
  File "/home/vpraveen/.cache/dazel/_dazel_vpraveen/216c8b41e526c3295d3b802489ac2034/execroot/ai_infra/bazel-out/k8-fastbuild/bin/magnet/packages/iva/build_wheel.runfiles/ai_infra/iva/faster_rcnn/spec_loader/spec_wrapper.py", line 614, in eval_trt_engine
AssertionError: TensorRT Engine for evaluation not found: /workspace/tlt-experiments/faster_rcnn/trt.int8.engine
Traceback (most recent call last):
  File "/usr/local/bin/faster_rcnn", line 8, in <module>
    sys.exit(main())
  File "/home/vpraveen/.cache/dazel/_dazel_vpraveen/216c8b41e526c3295d3b802489ac2034/execroot/ai_infra/bazel-out/k8-fastbuild/bin/magnet/packages/iva/build_wheel.runfiles/ai_infra/iva/faster_rcnn/entrypoint/faster_rcnn.py", line 12, in main
  File "/home/vpraveen/.cache/dazel/_dazel_vpraveen/216c8b41e526c3295d3b802489ac2034/execroot/ai_infra/bazel-out/k8-fastbuild/bin/magnet/packages/iva/build_wheel.runfiles/ai_infra/iva/common/entrypoint/entrypoint.py", line 296, in launch_job
AssertionError: Process run failed.

Am I missing something?

Please check if above file is available.

No, it’s not. Is there a way to generate that file? (I execute previous command in order on the example)

Which step did you run? Can you share the full command?

Sure
The command is
!tlt faster_rcnn evaluate --gpu_index 0 -k $KEY -e $SPECS_DIR/default_spec_resnet18_retrain_spec.txt

And my retrain spec file is:
# Copyright (c) 2017-2020, NVIDIA CORPORATION. All rights reserved.
random_seed: 42
enc_key: ‘tlt’
verbose: True
model_config {
input_image_config {
image_type: RGB
image_channel_order: ‘bgr’
size_height_width {
height: 384
width: 1248
}
image_channel_mean {
key: ‘b’
value: 103.939
}
image_channel_mean {
key: ‘g’
value: 116.779
}
image_channel_mean {
key: ‘r’
value: 123.68
}
image_scaling_factor: 1.0
max_objects_num_per_image: 100
}
arch: “resnet:18”
anchor_box_config {
scale: 64.0
scale: 128.0
scale: 256.0
ratio: 1.0
ratio: 0.5
ratio: 2.0
}
freeze_bn: True
freeze_blocks: 0
freeze_blocks: 1
roi_mini_batch: 256
rpn_stride: 16
use_bias: False
roi_pooling_config {
pool_size: 7
pool_size_2x: False
}
all_projections: True
use_pooling:False
}
dataset_config {
data_sources: {
tfrecords_path: “/workspace/tlt-experiments/data/tfrecords/kitti_trainval/kitti_trainval*”
image_directory_path: “/workspace/tlt-experiments/data/training”
}
image_extension: ‘png’
target_class_mapping {
key: ‘car’
value: ‘car’
}
target_class_mapping {
key: ‘van’
value: ‘car’
}
target_class_mapping {
key: ‘pedestrian’
value: ‘person’
}
target_class_mapping {
key: ‘person_sitting’
value: ‘person’
}
target_class_mapping {
key: ‘cyclist’
value: ‘cyclist’
}
validation_fold: 0
}
augmentation_config {
preprocessing {
output_image_width: 1248
output_image_height: 384
output_image_channel: 3
min_bbox_width: 1.0
min_bbox_height: 1.0
}
spatial_augmentation {
hflip_probability: 0.5
vflip_probability: 0.0
zoom_min: 1.0
zoom_max: 1.0
translate_max_x: 0
translate_max_y: 0
}
color_augmentation {
hue_rotation_max: 0.0
saturation_shift_max: 0.0
contrast_scale_max: 0.0
contrast_center: 0.5
}
}
training_config {
enable_augmentation: True
enable_qat: True
batch_size_per_gpu: 8
num_epochs: 12
retrain_pruned_model: “/workspace/tlt-experiments/faster_rcnn/model_1_pruned.tlt”
output_model: “/workspace/tlt-experiments/faster_rcnn/frcnn_kitti_resnet18_retrain.tlt”
rpn_min_overlap: 0.3
rpn_max_overlap: 0.7
classifier_min_overlap: 0.0
classifier_max_overlap: 0.5
gt_as_roi: False
std_scaling: 1.0
classifier_regr_std {
key: ‘x’
value: 10.0
}
classifier_regr_std {
key: ‘y’
value: 10.0
}
classifier_regr_std {
key: ‘w’
value: 5.0
}
classifier_regr_std {
key: ‘h’
value: 5.0
}

rpn_mini_batch: 256
rpn_pre_nms_top_N: 12000
rpn_nms_max_boxes: 2000
rpn_nms_overlap_threshold: 0.7

regularizer {
type: L2
weight: 1e-4
}

optimizer {
sgd {
lr: 0.02
momentum: 0.9
decay: 0.0
nesterov: False
}
}

learning_rate {
soft_start {
base_lr: 0.02
start_lr: 0.002
soft_start: 0.1
annealing_points: 0.8
annealing_points: 0.9
annealing_divider: 10.0
}
}

lambda_rpn_regr: 1.0
lambda_rpn_class: 1.0
lambda_cls_regr: 1.0
lambda_cls_class: 1.0
}
inference_config {
images_dir: ‘/workspace/tlt-experiments/data/testing/image_2’
model: ‘/workspace/tlt-experiments/faster_rcnn/frcnn_kitti_resnet18_retrain.epoch12.tlt’
batch_size: 1
detection_image_output_dir: ‘/workspace/tlt-experiments/faster_rcnn/inference_results_imgs_retrain’
labels_dump_dir: ‘/workspace/tlt-experiments/faster_rcnn/inference_dump_labels_retrain’
rpn_pre_nms_top_N: 6000
rpn_nms_max_boxes: 300
rpn_nms_overlap_threshold: 0.7
object_confidence_thres: 0.0001
bbox_visualize_threshold: 0.6
classifier_nms_max_boxes: 100
classifier_nms_overlap_threshold: 0.3
trt_inference {
trt_engine: ‘/workspace/tlt-experiments/faster_rcnn/trt.int8.engine’
trt_data_type: ‘int8’
max_workspace_size_MB: 2000
}
}
evaluation_config {
model: ‘/workspace/tlt-experiments/faster_rcnn/frcnn_kitti_resnet18_retrain.epoch12.tlt’
batch_size: 1
validation_period_during_training: 1
rpn_pre_nms_top_N: 6000
rpn_nms_max_boxes: 300
rpn_nms_overlap_threshold: 0.7
classifier_nms_max_boxes: 100
classifier_nms_overlap_threshold: 0.3
object_confidence_thres: 0.0001
use_voc07_11point_metric:False
trt_evaluation {
trt_engine: ‘/workspace/tlt-experiments/faster_rcnn/trt.int8.engine’
trt_data_type: ‘int8’
max_workspace_size_MB: 2000
}
gt_matching_iou_threshold: 0.5
}

You have set trt_evaluation in the spec file. But I’m afraid you have not generated the trt.int8.engine.
If you want to run evaluation against this trt.int8.engine, please generate it firstly. See section10(Deploy) in the jupyter example.
If you want to run evaluation against the existing tlt model instead of trt.int8.engine, please refer to the spec inside the jupyter example. See tlt_cv_samples_v1.0.2/faster_rcnn/specs/default_spec_resnet18.txt

Both solutions worked for me. Thanks