models icon indicating copy to clipboard operation
models copied to clipboard

AttributeError: 'SSDMobileNetV2KerasFeatureExtractor' object has no attribute 'restore_from_classification_checkpoint_fn'

Open purveshsharma50 opened this issue 6 years ago • 6 comments

After resolving save issue with
fine_tune_checkpoint: "ssd_mobilenet_v2_coco_2018_03_29/model.ckpt" from_detection_checkpoint: false load_all_detection_checkpoint_vars: true

I am getting - AttributeError: 'SSDMobileNetV2KerasFeatureExtractor' object has no attribute 'restore_from_classification_checkpoint_fn' error

purveshsharma50 avatar Jul 05 '20 08:07 purveshsharma50

@purveshsharma50

Please, fill issue template..

Please, share related code .Thanks!

ravikyram avatar Jul 06 '20 09:07 ravikyram

This is interesting - restore_from_classification_checkpoint_fn should be called by a meta arch object instead of feature extractor object. Have you sync'ed your repo to latest?

pkulzc avatar Jul 11 '20 01:07 pkulzc

Yes, I did. Is there anything else I can do.

On Fri, Jul 10, 2020, 8:09 PM pkulzc [email protected] wrote:

This is interesting - restore_from_classification_checkpoint_fn should be called by a meta arch object instead of feature extractor object. Have you sync'ed your repo to latest?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/tensorflow/models/issues/8783#issuecomment-656956308, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOLHXZPNZ6JP4CXDBPMEPGTR263VXANCNFSM4OQYRWHA .

purveshsharma50 avatar Jul 11 '20 02:07 purveshsharma50

Hi, I am getting the same error with Faster RCNN, I changed my previous config file as was mentioned in the blog to change the feature extractor to add Keras in it. Please let me know if someone finds the solution Here is my config file.

Faster R-CNN with Resnet-101 (v1), configuration for MSCOCO Dataset.

Users should configure the fine_tune_checkpoint field in the train config as

well as the label_map_path and input_path fields in the train_input_reader and

eval_input_reader. Search for "PATH_TO_BE_CONFIGURED" to find the fields that

should be configured.

model { faster_rcnn { num_classes: 26 image_resizer { keep_aspect_ratio_resizer { min_dimension: 600 max_dimension: 900 } } feature_extractor { type: 'faster_rcnn_resnet101_keras' first_stage_features_stride: 16 } first_stage_anchor_generator { grid_anchor_generator { scales: [0.25, 0.5, 1.0, 2.0] aspect_ratios: [0.5, 1.0, 2.0] height_stride: 16 width_stride: 16 } } first_stage_box_predictor_conv_hyperparams { op: CONV regularizer { l2_regularizer { weight: 0.0 } } initializer { truncated_normal_initializer { stddev: 0.01 } } } first_stage_nms_score_threshold: 0.0 first_stage_nms_iou_threshold: 0.7 first_stage_max_proposals: 3000 first_stage_localization_loss_weight: 2.0 first_stage_objectness_loss_weight: 1.0 initial_crop_size: 14 maxpool_kernel_size: 2 maxpool_stride: 2 second_stage_box_predictor { mask_rcnn_box_predictor { use_dropout: false dropout_keep_probability: 1.0 fc_hyperparams { op: FC regularizer { l2_regularizer { weight: 0.0 } } initializer { variance_scaling_initializer { factor: 1.0 uniform: true mode: FAN_AVG } } } } } second_stage_post_processing { batch_non_max_suppression { score_threshold: 0.0 iou_threshold: 0.2 max_detections_per_class: 100 max_total_detections: 300 } score_converter: SOFTMAX } second_stage_localization_loss_weight: 2.0 second_stage_classification_loss_weight: 1.0 } }

train_config: { batch_size: 2 optimizer { momentum_optimizer: { learning_rate: { manual_step_learning_rate { initial_learning_rate: 0.00003 schedule { step: 900000 learning_rate: .00004 } schedule { step: 1200000 learning_rate: .000003 } } } momentum_optimizer_value: 0.9 } use_moving_average: false } gradient_clipping_by_norm: 10.0 fine_tune_checkpoint: "faster_rcnn_resnet101_coco_2018_01_28/model.ckpt" from_detection_checkpoint: false load_all_detection_checkpoint_vars: true data_augmentation_options { random_horizontal_flip{

}
random_adjust_brightness{

}
random_adjust_contrast{
}
random_adjust_hue{

}
random_adjust_saturation{

}
random_distort_color{

}
random_jitter_boxes{
  
}
random_crop_image{
}

random_pixel_value_scale{
     minval: 0.6
}
random_image_scale{
   
}
random_rgb_to_gray{
     probability : 0.5
}

} }

train_input_reader: { tf_record_input_reader { input_path: "data1/train.record" } label_map_path: "training_new/object_detection_new.pbtxt" max_number_of_boxes: 400 }

eval_config: { num_examples: 3

Note: The below line limits the evaluation process to 10 evaluations.

Remove the below line to evaluate indefinitely.

}

eval_input_reader: { tf_record_input_reader { input_path: "data1/test.record" } label_map_path: "training_new/object_detection_new.pbtxt" shuffle: false num_readers: 1 max_number_of_boxes: 400 }

Hs1000 avatar Jul 12 '20 05:07 Hs1000

I can't tell what the issue is without proper info as instructed by the templates. This maybe helpful to you https://github.com/tensorflow/models/issues/8855

pkulzc avatar Jul 14 '20 23:07 pkulzc

@Hs1000 @purveshsharma50 Did either of you figure out how to fix the issue? I am running in to the same error

hannadiamond avatar Sep 23 '20 20:09 hannadiamond