Mstfakts / Building-Detection-MaskRCNN

Building detection from the SpaceNet dataset by using Mask RCNN.
231 stars 21 forks source link

Need help to load the Pre-trained Model #1

Closed ujwalakoriraj closed 3 years ago

ujwalakoriraj commented 4 years ago

Hello,

Trying your code from here: https://github.com/Mstfakts/Building-Detection-MaskRCNN for one of my Engineering-final-year project. I downloaded the pre-trained model from here: https://drive.google.com/file/d/1X-vodJEXvnu6uEn0TDLt1VhHkT17eOkG/view

I am trying to load the model like I have done for 'Image Classifier using CNN' project, where I loaded the model (keras.model.load_model), then loaded the test image (keras.preprocessing.image.load_img), then made the model predict ( keras.model.load_model .predict), then displayed the prediction.

Trying the above process for your code gives an error as follows:


runfile('D:/python/building_detection/7_Building-Detection-MaskRCNN-master/load_model.py', wdir='D:/python/building_detection/7_Building-Detection-MaskRCNN-master') Traceback (most recent call last):

File "D:\python\building_detection\7_Building-Detection-MaskRCNN-master\load_model.py", line 6, in loaded_model=load_model('D:/python/building_detection/7_Building-Detection-MaskRCNN-master/Building-Detection.h5')

File "C:\Users\rajak\anaconda3\envs\mrcnn_building\lib\site-packages\keras\engine\saving.py", line 492, in load_wrapper return load_function(*args, **kwargs)

File "C:\Users\rajak\anaconda3\envs\mrcnn_building\lib\site-packages\keras\engine\saving.py", line 584, in load_model model = _deserialize_model(h5dict, custom_objects, compile)

File "C:\Users\rajak\anaconda3\envs\mrcnn_building\lib\site-packages\keras\engine\saving.py", line 270, in _deserialize_model model_config = h5dict['model_config']

File "C:\Users\rajak\anaconda3\envs\mrcnn_building\lib\site-packages\keras\utils\io_utils.py", line 318, in getitem raise ValueError('Cannot create group in read-only mode.')

ValueError: Cannot create group in read-only mode.


Could you please help me with using the pre-trained model and detect the building-footprints from a given test image? Please share a sample code for the same.

Awaiting your response.

Thank you.

Mstfakts commented 4 years ago

Hello Ujwala, I suspect that the problem may because of the h5 file. I mean you need to create a structure first then try to load the pre-trained h5 file. By the way, I worked on this project again and will upload version2.0 as son as possible.