EdjeElectronics / TensorFlow-Object-Detection-API-Tutorial-Train-Multiple-Objects-Windows-10

How to train a TensorFlow Object Detection Classifier for multiple object detection on Windows
Apache License 2.0
2.92k stars 1.3k forks source link

Error while running the training command. Saying 'FasterRcnn' object has no attribute 'first_stage_only' #121

Open hail2m15 opened 6 years ago

hail2m15 commented 6 years ago

Traceback (most recent call last): File "train.py", line 163, in tf.app.run() File "C:\Users\haiL\Anaconda2\envs\tf15\lib\site-packages\tensorflow\python\platform\app.py", line 125, in run _sys.exit(main(argv)) File "train.py", line 159, in main worker_job_name, is_chief, FLAGS.train_dir) File "C:\tensorflow1\models\research\object_detection\trainer.py", line 193, in train detection_model = create_model_fn() File "C:\tensorflow1\models\research\object_detection\builders\model_builder.py", line 85, in build return _build_faster_rcnn_model(model_config.faster_rcnn, is_training) File "C:\tensorflow1\models\research\object_detection\builders\model_builder.py", line 231, in _build_faster_rcnn_model first_stage_only = frcnn_config.first_stage_only AttributeError: 'FasterRcnn' object has no attribute 'first_stage_only'

pilaurent commented 6 years ago

I do have the same error actually. Running on Windows 10. Trying atm but it is the same with tensorflow-gpu 1.9 as well as 1.5

pilaurent commented 6 years ago

While reading the code, all seems to be due to the model config within model_builder.py.

model_config: A model.proto object containing the config for the desired DetectionModel.

I just ran the protoc command in 2f. Compile Protobufs and run setup.py and the error vanished

For info, this is working with tensorflow-gpu 1.10.0 which depends on protobuf 3.6.1

youraustin commented 6 years ago

While reading the code, all seems to be due to the model config within model_builder.py.

model_config: A model.proto object containing the config for the desired DetectionModel.

I just ran the protoc command in 2f. Compile Protobufs and run setup.py and the error vanished

For info, this is working with tensorflow-gpu 1.10.0 which depends on protobuf 3.6.1

Did you solove it? would you mind help me? I did this project, the system is: windows 10+ anaconda+tensorflow 1.7. same error for me, I try many times but it always appear. Hope you could tell me how to make the error vanished.

Umraz-Hussain1 commented 2 years ago

can someone please help to resolve this issue.while loading my .pth model im getting this error kindly help


AttributeError Traceback (most recent call last) /tmp/ipykernel_242074/2710145507.py in ----> 1 model.load_state_dict(torch.load('models/fasterrcnn_resnet50_fpn_pneumonia_detection.pth'))

~/anaconda3/envs/pytorch1/lib/python3.9/site-packages/torch/nn/modules/module.py in load_state_dict(self, state_dict, strict) 1453 # copy state_dict so _load_from_state_dict can modify it 1454 metadata = getattr(state_dict, '_metadata', None) -> 1455 state_dict = state_dict.copy() 1456 if metadata is not None: 1457 # mypy isn't aware that "_metadata" exists in state_dict

~/anaconda3/envs/pytorch1/lib/python3.9/site-packages/torch/nn/modules/module.py in getattr(self, name) 1175 if name in modules: 1176 return modules[name] -> 1177 raise AttributeError("'{}' object has no attribute '{}'".format( 1178 type(self).name, name)) 1179

AttributeError: 'FasterRCNN' object has no attribute 'copy'