keras_frcnn icon indicating copy to clipboard operation
keras_frcnn copied to clipboard

Please Me.( /model/kitti_frcnn_last.hdf5)

Open FudoDaichi opened this issue 7 years ago • 10 comments

Unable to open file (unable to open file: name = './model/kitti_frcnn_last.hdf5', errno = 2, error message = 'No such file or directory', flags = 0, o_flags = 0).

How to solve this problem? Where to get this file? Please help me figure it out.

FudoDaichi avatar Feb 27 '18 20:02 FudoDaichi

Do you use the code directly on testing without training?In my opinion,the file named './model/kitti_frcnn_last.hdf5' is generated during training on your dataset.

steeveen avatar Mar 18 '18 13:03 steeveen

When i run the training program (python train_frcnn_kitti.py), I have got an error message which was following

amori@fmg06[~/keras_frcnn]: python train_frcnn_kitti.py
Using TensorFlow backend.
Parsing annotation files
Traceback (most recent call last):
  File "train_frcnn_kitti.py", line 256, in <module>
    train_kitti()
  File "train_frcnn_kitti.py", line 38, in train_kitti
    all_images, classes_count, class_mapping = get_data(cfg.simple_label_file)
  File "/lmb/home/amori/go/workspace/keras_frcnn/keras_frcnn/simple_parser.py", line 39, in get_data
    (rows, cols) = img.shape[:2]
AttributeError: 'NoneType' object has no attribute 'shape'


Do you have any idea to solve this issue?

I am using those versions: Python 3.6.1 numpy 1.13.3 opencv-python 3.4.1.15

Thanks

akihirom2017 avatar Jun 21 '18 14:06 akihirom2017

Sorry, I figured it out. The problem was a path in kitti_simple_label.txt. Then, I have got the same issue the first person commented. (e.g. Unable to open file (Unable to open file: name = './model/kitti_frcnn_last.hdf5', errno = 2, error message = 'no such file or directory', flags = 0, o_flags = 0) Could not load pretrained model weights. Weights can be found in the keras application folder https://github.com/fchollet/keras/tree/master/keras/applications )

I jump into the github page, but there was no file kitti_frcnn_last.hdf5 in model directory (or there is no model directory)

Could you help me to figure this out?

Thanks

akihirom2017 avatar Jun 21 '18 15:06 akihirom2017

I have the same problem. Can you tell me how you solved it?

AttributeError: 'NoneType' object has no attribute 'shape'

lilei132 avatar Sep 05 '18 13:09 lilei132

When i run the training program (python train_frcnn_kitti.py), I have got an error message which was following

amori@fmg06[~/keras_frcnn]: python train_frcnn_kitti.py
Using TensorFlow backend.
Parsing annotation files
Traceback (most recent call last):
  File "train_frcnn_kitti.py", line 256, in <module>
    train_kitti()
  File "train_frcnn_kitti.py", line 38, in train_kitti
    all_images, classes_count, class_mapping = get_data(cfg.simple_label_file)
  File "/lmb/home/amori/go/workspace/keras_frcnn/keras_frcnn/simple_parser.py", line 39, in get_data
    (rows, cols) = img.shape[:2]
AttributeError: 'NoneType' object has no attribute 'shape'

Do you have any idea to solve this issue?

I am using those versions: Python 3.6.1 numpy 1.13.3 opencv-python 3.4.1.15

Thanks

It cannot read pic correctly cause the path is wrong! Go to change the path for pic in cfg.simple_label_file

xincxiong avatar Nov 14 '18 07:11 xincxiong

Do you use the code directly on testing without training?In my opinion,the file named './model/kitti_frcnn_last.hdf5' is generated during training on your dataset.

Around line 97-109, you need to change cfg.model_path to cfg.base_net_weights to load pretrain weights.

cfg.model_path for output!!

xincxiong avatar Nov 14 '18 07:11 xincxiong

As far as I understand, this is how it works:

  • cfg.model_path points to model_trained/model_frcnn.vgg.hdf5 and is used to output the trained network or to load an existing network if you want to continue training it
  • cfg.base_net_weights points to model/resnet50_weights_tf_dim_ordering_tf_kernels.h5. It is the base network for the classification network of Faster-RCNN. It should be downloaded from https://github.com/fchollet/deep-learning-models/releases/download/v0.2/resnet50_weights_tf_dim_ordering_tf_kernels.h5 and put in the model directory (create it if it doesn't exist). Then change model_classifier.load_weights(cfg.model_path, by_name=True) to model_classifier.load_weights(cfg.base_net_weights, by_name=True) in train_frcnn_kitti.py, line 94.

Please correct me if I'm wrong.

Attila94 avatar Nov 19 '18 03:11 Attila94

@Attila94 Model_classifier.load_weights should also be changed?

zhangyufei1995 avatar Jun 28 '19 10:06 zhangyufei1995

Sorry, I figured it out. The problem was a path in kitti_simple_label.txt. Then, I have got the same issue the first person commented. (e.g. Unable to open file (Unable to open file: name = './model/kitti_frcnn_last.hdf5', errno = 2, error message = 'no such file or directory', flags = 0, o_flags = 0) Could not load pretrained model weights. Weights can be found in the keras application folder https://github.com/fchollet/keras/tree/master/keras/applications )

I jump into the github page, but there was no file kitti_frcnn_last.hdf5 in model directory (or there is no model directory)

Could you help me to figure this out?

Thanks

how to solve The problem was a path in kitti_simple_label.txt.?

1wansiyuan avatar Aug 29 '19 13:08 1wansiyuan

There are two issues to be determined.

One is to train the model. With regard to the training, it is necessary to download the dataset. Without downloading the dataset, it could not be trained. And it could generate the error as follows.

File ./keras_frcnn/keras_frcnn/simple_parser.py", line 34, in get_data (rows, cols) = img.shape[:2] AttributeError: 'NoneType' object has no attribute 'shape'

Another is related to either test or predict. With regard to the test or predict, it is necessary to have correct paths in the file of kitti_simple_label.txt by adoping the script of generate_simple_kitti_anno_file.py. Please notice the original kitti_simple_label.txt inlcudes the author's path as follows. If you use the author's txt file, it inevitably generate the error as follows.

OSError: Unable to open file (unable to open file: name = './model/kitti_frcnn_last.hdf5', errno = 2, error message = 'No such file or directory', flags = 0, o_flags = 0)

/media/jintian/Netac/Datasets/Kitti/object/training/image_2/000000.png,712.40,143.00,810.73,307.92,Pedestrian

Anyway, all the scripts of Keras_frcnn is quite old and obsolete. So it is hard to run the scripts. So I make it to adapt to Keras_frcnn adapt to Tensorflow 2.3 and Keras 2.4.

mikechen66 avatar Apr 26 '21 03:04 mikechen66