Mask R-CNN on Custom Dataset | Practical Implementation

Sdílet
Vložit
  • čas přidán 29. 08. 2024
  • Mask RCNN with Tensorflow2 video link: • Instance Segmentation ...
    In this video, I have explained step by step how to train Mask R-CNN on Custom Dataset.
    Github link: github.com/Aar...
    Download mrcnn folder from this repository: github.com/mat...
    Download coco weights : github.com/mat...
    If you have any questions with what we covered in this video then feel free to ask in the comment section below & I'll do my best to answer your queries.
    Please consider clicking the SUBSCRIBE button to be notified for future videos & thank you all for watching.
    Channel: www.youtube.co....
    Support my channel 🙏 by LIKE ,SHARE & SUBSCRIBE
    Contact: aarohisingla1987@gmail.com
    Instance Segmentation with Mask R-CNN:
    Mask RCNN is a deep neural network aimed to solve instance segmentation problem in machine learning or computer vision. In other words, it can separate different objects in a image or a video. You give it a image, it gives you the object bounding boxes, classes and masks.
    There are two stages of Mask RCNN. First, it generates proposals about the regions where there might be an object based on the input image. Second, it predicts the class of the object, refines the bounding box and generates a mask in pixel level of the object based on the first stage proposal. Both stages are connected to the backbone structure.
    What is backbone? Backbone is a FPN style deep neural network. It consists of a bottom-up pathway , a top-bottom pathway and lateral connections. Bottom-up pathway can be any ConvNet, usually ResNet or VGG, which extracts features from raw images. Top-bottom pathway generates feature pyramid map which is similar in size to bottom-up pathway. Lateral connections are convolution and adding operations between two corresponding levels of the two pathways. FPN outperforms other single ConvNets mainly for the reason that it maintains strong semantically features at various resolution scales.
    Now let’s look at the first stage. A light weight neural network called RPN scans all FPN top-bottom pathway( hereinafter referred to feature map) and proposes regions which may contain objects. That’s all it is. While scaning feature map is an efficient way, we need a method to bind features to its raw image location. Here come the anchors. Anchors are a set of boxes with predefined locations and scales relative to images. Ground-truth classes( only object or background binary classified at this stage) and bounding boxes are assigned to individual anchors according to some IoU value. As anchors with different scales bind to different levels of feature map, RPN uses these anchors to figure out where of the feature map ‘should’ get an object and what size of its bounding box is. Here we may agree that convolving, downsampling and upsampling would keep features staying the same relative locations as the objects in original image, and wouldn’t mess them around.
    At the second stage, another neural network takes proposed regions by the first stage and assign them to several specific areas of a feature map level, scans these areas, and generates objects classes(multi-categorical classified), bounding boxes and masks. The procedure looks similar to RPN. Differences are that without the help of anchors, stage-two used a trick called ROIAlign to locate the relevant areas of feature map, and there is a branch generating masks for each objects in pixel level. Work completed.
    #maskrcnn #objectdetection #deeplearning #ai #artificialintelligence #ml #computervision #cnn #convolutionalneuralnetwork

Komentáře • 291

  • @debarunkumer2019
    @debarunkumer2019 Před 3 lety +2

    Your videos are so well "architected". It takes us to the depths never taken by others. THANK YOU!!!!!

  • @adityanjsg99
    @adityanjsg99 Před 2 lety

    I looked up the Walled Abdulla blog post. The customData Class had me stuck for rwo days, this explanation solves it all. Thanks a many, Aarohi.
    This is the 2nd time your efforts are helping me, first one I guess FPN pyramid using CNN.

    • @CodeWithAarohi
      @CodeWithAarohi  Před 2 lety

      Glad to hear that. Keep watching and learning 😊

  • @sumedh2358
    @sumedh2358 Před 2 lety

    Thank you maam. Most of the other tutorials dont explain in such way. Your explaination helps me to understand code in deep. Thank u very much

  • @anjalipc9953
    @anjalipc9953 Před 2 lety

    Thank you very much ma'am. It is my first time watching a clear cut example with step by step explanation for mask-rcnn training on Custom Dataset.

  • @ikrambekkar6657
    @ikrambekkar6657 Před rokem +1

    thank you for your answer, the problem is solved but it gives me the high loss rate which implies a bad detection, so please what should I do to correct it.
    Epoch 30/30
    100/100 [==============================] - 784s 8s/step - batch: 49.5000 - size: 1.0000 - loss: 0.3552 - rpn_class_loss: 0.0052 - rpn_bbox_loss: 0.1705 - mrcnn_class_loss: 0.0218 - mrcnn_bbox_loss: 0.0532 - mrcnn_mask_loss: 0.1044 - val_loss: 3.8523 - val_rpn_class_loss: 0.1956 - val_rpn_bbox_loss: 2.3940 - val_mrcnn_class_loss: 0.3829 - val_mrcnn_bbox_loss: 0.3561 - val_mrcnn_mask_loss: 0.5238
    PLEASE HELP ME

  • @Automotive_Engineer
    @Automotive_Engineer Před 3 lety

    Thank you so much Ma'am. Your explanation is really Amazing. It has helped us alot. It is very knowledge full. Thank you Again Madam

  • @saikiran6365
    @saikiran6365 Před 2 lety +3

    polygons = [r['shape_attributes'] for r in a['regions']]
    22 objects = [s['region_attributes']['name'] for s in a['regions']]
    23 print("objects:",objects)
    TypeError: string indices must be integers
    why am i getting this error

  • @seetharamnageshappe5013
    @seetharamnageshappe5013 Před 3 lety +4

    Madam
    We are using only one annotations1 = json.load(open('D:/MaskRCNN-main/Dataset/train/via_project.json'))
    and while preparing datset we are sending two train and val but using only one annotations
    pl. clarify

  • @amanshaikh7413
    @amanshaikh7413 Před 3 lety

    Thanks a lot ma'am, You have done a great Job. Thank you so much

  • @soravsingla8782
    @soravsingla8782 Před 3 lety +2

    Really Amazing explanation by Ma’am

  • @_la_zu_li
    @_la_zu_li Před 2 lety

    This is great, thanks! :D
    It really helped me

  • @sheshankk3431
    @sheshankk3431 Před 3 lety +4

    I tried to do this project on colab but it's not moving beyond step9/10 of epoch 1. I also have a doubt about where do we use the val json file as you didn't mention it anywhere

    • @rakeshgnits
      @rakeshgnits Před 3 lety

      Rakesh Yacharam
      hi can you help in with this error
      I got error as "----> 1 model.train(dataset_train, dataset_val,
      2 learning_rate=config.LEARNING_RATE,
      3 epochs=10,
      4 layers='heads')
      5
      NameError: name 'model' is not defined" ....
      how to over come this error

  • @sushantparajuli611
    @sushantparajuli611 Před rokem

    Thank you so much for this video. Really helpful.

    • @CodeWithAarohi
      @CodeWithAarohi  Před rokem

      Glad it was helpful!

    • @sushantparajuli611
      @sushantparajuli611 Před rokem

      @@CodeWithAarohi I have one question. maskRCNN requires tensorflow 1.3.0 as per the documentation but some methods don’t work anymore so I installed Tensorflow 1.5.0 and the model is training well but my GPU is not working. Because I installed CUDA and cuDNN for TF version 1.3.0 before. If I reinstall the CUDA versions compatible for TF1.5 it should work right? Or would you suggest the most stable version of tensorflow? Expecting your response ma‘am. Thank you in advance.

    • @CodeWithAarohi
      @CodeWithAarohi  Před rokem

      @@sushantparajuli611 Use python 3.6.8 , tensorflow 1.15.0, h5py 2.10.0, keras 2.2.4 and my numpy version is 1.19.5

    • @CodeWithAarohi
      @CodeWithAarohi  Před rokem

      These versions are working well for me

    • @sushantparajuli611
      @sushantparajuli611 Před rokem

      @@CodeWithAarohi Thank you so much for your quick response ma‘am. Really appreciate.😊😊😊

  • @awaisahmad5908
    @awaisahmad5908 Před 2 lety +1

    Great demonstration.
    Kindly share the idea to annotating the brain tumor ROIs in MRI images dataset I have downloaded from kaggle.
    Want to segment the tumor portion and draw bounding box.
    Already done classification part using VGG-16.

  • @nadabelhadjslimen797
    @nadabelhadjslimen797 Před 3 lety +1

    hello , I have tried to test the detection on my own dataset.
    There is no error but I got this message : "NO INSTANCE TO DISPLAY"
    I see instances but the detection are not good

  • @student747
    @student747 Před 3 lety

    BEST WOMAN IN THE WORLD!!! THANK YOU!!!!!!!!! AAAAAAAAAA

  • @geeky_explorer9105
    @geeky_explorer9105 Před 3 lety

    Great explanation, ma'am

  • @iramjaved4951
    @iramjaved4951 Před 3 lety

    very informative video.
    many thanks madam

  • @ajithkumarspartan
    @ajithkumarspartan Před 3 lety

    Thanks a lot Aarohi !!!

  • @ZeelBCE
    @ZeelBCE Před 3 lety

    Mam Thank you so much for the detailed explanation and analysis. You have explained everything very precisely without missing any step. It has helped me a lot as I am making a project on mask rcnn in my college. Mam, at the last I am facing issues like ValueError:
    The following Variables were created within a Lambda layer (anchors)
    but are not tracked by said layer:
    The layer cannot safely ensure proper Variable reuse across multiple
    calls, and consquently this behavior is disallowed for safety. Lambda
    layers are not well suited to stateful computation; instead, writing a
    subclassed Layer is the recommend way to define layers with
    Variables.
    I did this in Jupyter notebook and i am getting this.
    If possible can you please tell all the things that you installed before executing python code in cmd prompt.
    Thank you

    • @CodeWithAarohi
      @CodeWithAarohi  Před 3 lety +1

      This code is working on python 3.6.8, tensorflow 1.14.1 and keras 2.3.0

  • @ahamedibrahim555
    @ahamedibrahim555 Před 2 lety

    The way explaining is cute

  • @suganyadurai3607
    @suganyadurai3607 Před rokem

    Thanks a lot mam..

  • @manasaprabhala1108
    @manasaprabhala1108 Před 3 lety +3

    Hi, I have question. I implemented everything as you said; however, no h5 files are being created in the logs folder. How to fix? (I have tf= 1.13.1, python=3.7, keras=2.3.0)

    • @manasaprabhala1108
      @manasaprabhala1108 Před 3 lety

      RemoveStackStridedSliceSameAxis node proposal_targets….. is the errror

  • @1Seung
    @1Seung Před rokem +1

    Hello. Thank you for your video. It helps me a lot.
    1 little question about the annotation section tho.
    Q) you said we need to change the annotation directory to the training folder so that the json file or training folder can be used. However, we actually labeled training folder AND validation folder as well. What about the json file of val folder?? We are not going to use it?
    Please answer my question when you are available.. ! Thank you once again for the helps!

  • @9433778142
    @9433778142 Před 3 lety

    Really a gem Mam

    • @CodeWithAarohi
      @CodeWithAarohi  Před 3 lety

      Thanks a lot

    • @9433778142
      @9433778142 Před 3 lety

      @@CodeWithAarohi Mam, after having the trained .h5 weights, can you please help me to get the code of how to load the weight in a model? I am not getting it. Thanks in advance

    • @9433778142
      @9433778142 Před 3 lety

      @@CodeWithAarohi Mam please help me with the prediction code. Need it urgently. Thanks

    • @CodeWithAarohi
      @CodeWithAarohi  Před 3 lety

      @@9433778142 WEIGHTS_PATH = "logs/object20210626T2237/mask_rcnn_object_0010.h5" # change it
      # Load weights
      print("Loading weights ", WEIGHTS_PATH)
      model.load_weights(weights_path, by_name=True)

    • @CodeWithAarohi
      @CodeWithAarohi  Před 3 lety

      # Run detections
      image_id = random.choice(dataset.image_ids)
      #image_id = 'D:\env_with_tensorflow1.14\jerry_maskrcnn\test.png'
      print("image id is :",image_id)
      image, image_meta, gt_class_id, gt_bbox, gt_mask =modellib.load_image_gt(dataset, config, image_id, use_mini_mask=False)
      info = dataset.image_info[image_id]
      print("image ID: {}.{} ({}) {}".format(info["source"], info["id"], image_id,dataset.image_reference(image_id)))
      # Run object detection
      results = model.detect([image], verbose=1)

  • @arnavthakur5409
    @arnavthakur5409 Před 3 lety

    Thank you for this tutorial mam

  • @ahmetrecepyan9748
    @ahmetrecepyan9748 Před 3 lety

    Awesome 👌

  • @nedjmahachemi990
    @nedjmahachemi990 Před 3 měsíci

    please give me solution of this error FutureWarning: Input image dtype is bool. Interpolation is not defined with bool data type. Please set order to 0 or explicitely cast input image to another data type. Starting from version 0.19 a ValueError will be raised instead of this warning.
    order = _validate_interpolation_order(image.dtype, order)

  • @hargunkaur444
    @hargunkaur444 Před rokem

    thank you maam for the explaination. Could you please help why im getting this error when i run this on my dataset AttributeError: 'str' object has no attribute 'decode'

  • @ikrambekkar6657
    @ikrambekkar6657 Před rokem +1

    thank you for this video, please in the training phase I got the following error:
    ResourceExhaustedError: OOM when allocating tensor of shape [] and type float
    [[{{node mul/y}}]]
    PLEASE HELP ME

    • @CodeWithAarohi
      @CodeWithAarohi  Před rokem

      memory is not sufficient. To solve this issue, you can Reduce the batch size of your model

    • @ikrambekkar6657
      @ikrambekkar6657 Před rokem

      @@CodeWithAarohi How i do it ,in which file I find it,
      please another error: ValueError: Error when checking input: expected input_image_meta to have shape (14,) but got array with shape (16,)

    • @ikrambekkar6657
      @ikrambekkar6657 Před rokem

      @@CodeWithAarohi thank you for your answer, the problem is solved but it gives me the high loss rate which implies a bad detection, so please what should I do to correct it.
      Epoch 30/30
      100/100 [==============================] - 784s 8s/step - batch: 49.5000 - size: 1.0000 - loss: 0.3552 - rpn_class_loss: 0.0052 - rpn_bbox_loss: 0.1705 - mrcnn_class_loss: 0.0218 - mrcnn_bbox_loss: 0.0532 - mrcnn_mask_loss: 0.1044 - val_loss: 3.8523 - val_rpn_class_loss: 0.1956 - val_rpn_bbox_loss: 2.3940 - val_mrcnn_class_loss: 0.3829 - val_mrcnn_bbox_loss: 0.3561 - val_mrcnn_mask_loss: 0.5238
      PLEASE HELP ME

  • @AmritaSingh-vh9mi
    @AmritaSingh-vh9mi Před 2 lety

    thanks, ma'am .. Please upload one video on DetectoRS: Detecting Objects with Recursive Feature Pyramid and Switchable Atrous Convolution for a custom dataset

  • @notimportant9018
    @notimportant9018 Před 3 lety

    amazing

  • @mohammedbari3826
    @mohammedbari3826 Před rokem

    Thanks for such a clear explanation. Which python, tensorflow and keras version are you using.

  • @hakimhalouat1896
    @hakimhalouat1896 Před 3 lety +3

    Thank you for the explanation, I want to know if I have a big dataset (more than 1000 images) should I annotate all the images ?

  • @rohitarora318
    @rohitarora318 Před 3 lety

    Helpful Videos

  • @hungnguyenngocduy2088
    @hungnguyenngocduy2088 Před 3 lety +2

    Hello Aarohi. Thank you for the kind explanation. But I am encountering an error when executing. In my dataset, I have 21 training data and 09 validation data. At the time of execution, an error appears like 'No such File' giving the path of validation folder. The file, program is looking for, is in the training folder. But it searches for that particular file in the validation folder as well. How can I solve this?. Hope this is clear to you

    • @vajirastanley5216
      @vajirastanley5216 Před 3 lety

      Hi I've got a same problem. Can you fix it? If so can you tell me pls

    • @developerr4001
      @developerr4001 Před 3 lety

      ​@@vajirastanley5216 even I have the same issue. did you get a solution? :(

    • @harinderkaur8320
      @harinderkaur8320 Před 2 lety +1

      I was facing same problem
      1. Place Json file in val and train folder with "same name"
      2. Give json file path like this:
      annotations=json.load(open(os.path.join(dataset_dir, 'Json file name')))
      I hope it helps

    • @richasharma5949
      @richasharma5949 Před 2 lety

      @@harinderkaur8320 this work. Thanks !

    • @sakshibansal2488
      @sakshibansal2488 Před 2 lety

      @@richasharma5949 Hi... Can you please tell what exactly did you do? I didn't understood.

  • @GlenBennetHermon
    @GlenBennetHermon Před rokem

    Thank you for this video, I'm implementing RCNN on satellite images, but I'm not getting the desired accuracy score. After considering Augmentation techniques, I was wondering if there is a way to choose the best Augmentation technique. Please Help! Thanks in advance!

    • @CodeWithAarohi
      @CodeWithAarohi  Před rokem

      You can try simulated atmospheric effects or geometric transformations to simulate different angles and perspectives.

  • @manasagr2497
    @manasagr2497 Před rokem

    i could not run the same python code in the command prompt

  • @foxil4370
    @foxil4370 Před 3 lety +1

    may I ask you ?

    as far as I understood in log folder we'll get trained weights, not full model, won't we ?
    And could you help me ? how can I convert this output to JS model.
    I should train model and load this weights (which I got after your tutorial) to my new model ?

  • @srilakshmia6278
    @srilakshmia6278 Před 2 lety

    Dear mam ,
    I tried as you said .. Initially some errors came i cleared all those errors, now it is in FIRST EPOCH for nearly more than 3 hours ... i have only 10 images ... Kindly help pls

  • @SindyanCartoonJordanian

    Thank you for the explanation, but please , How we can convert json file into images to be trained or tested with CNN in another program?

  • @asmajegham1309
    @asmajegham1309 Před 3 lety

    Hello mam, thanks for the implementation, very clear !
    Do you think that counting number of objects in a dense scene is possible through mask rcnn, for exemple in wood logs ?

  • @vikashkumar-cr7ee
    @vikashkumar-cr7ee Před rokem

    AttributeError: module 'keras.engine' has no attribute 'Layer' while running the code python custom.py. Could you please help me ?

  • @vikashkumar-cr7ee
    @vikashkumar-cr7ee Před rokem

    Dear Aarohi ,
    for validation I have three images, then why it is showing error that 4.jpg is not found?
    FileNotFoundError: No such file: 'C:\Users\HP\Desktop\Aarohi\MASK_RCNN\env\venv36\mask_rcnn\dataset\val\4.jpg'

    • @vikashkumar-cr7ee
      @vikashkumar-cr7ee Před rokem

      Actually, Val folder have three images named 1.jpg, 2.jpg, and 3.jpg; so why is it asking for 4.jpg?

  • @navinbondade5365
    @navinbondade5365 Před 3 lety

    The projection is many time blurry and hard to see, I suggest to record videos for youtube separately by screen-recording

  • @ragisimon4069
    @ragisimon4069 Před 3 lety +1

    Mam,how to use this code in python Jupyter notebook.
    This mrcnn repository code from github where to place , while running this code in python Jupyter notebook.

    • @CodeWithAarohi
      @CodeWithAarohi  Před 3 lety

      Paste the whole code in jupyter notebook

    • @ragisimon4069
      @ragisimon4069 Před 3 lety +1

      @@CodeWithAarohi ok mam.
      Thank you so much for your reply ....
      Video is very helpful for me to do my project.

    • @CodeWithAarohi
      @CodeWithAarohi  Před 3 lety

      @@ragisimon4069 welcome

    • @ragisimon4069
      @ragisimon4069 Před 3 lety +1

      @@CodeWithAarohi eagerly waiting for test video of maskrcnn algorithm....

  • @vaibhavkurrey5433
    @vaibhavkurrey5433 Před rokem

    ma'am How can i resolve this error:- *TypeError: unhashable type: 'ListWrapper'*

    • @CodeWithAarohi
      @CodeWithAarohi  Před rokem

      The "unhashable type: 'ListWrapper'" error typically occurs when you are trying to use a list as a key in a dictionary. In Python, dictionaries are data structures that store key-value pairs, where the keys must be unique and immutable. Since a list is a mutable data type, it cannot be used as a dictionary key.
      To resolve this error, you will need to convert the list to an immutable data type, such as a tuple, before using it as a dictionary key. For example, you could use the following code to convert the list to a tuple and then use it as a dictionary key:
      Copy code
      list_key = ["hello", "world"]
      tuple_key = tuple(list_key)
      my_dict = {tuple_key: "value"}
      Alternatively, you could use the list as the value in the dictionary, rather than the key. This would allow you to store multiple values for each list, as long as the lists themselves are unique:
      Copy code
      list_key = ["hello", "world"]
      my_dict = {list_key: "value"}

  • @harshchindarkar5887
    @harshchindarkar5887 Před rokem

    Maam im trying to train my model in colab but its using CPU rather than GPU provided by colab, and because of that training is taking much more time to complete what could be the issue?

  • @GlenBennetHermon
    @GlenBennetHermon Před rokem

    Hi, How to configure Gpu while running offline? What should be the value of GPU_COUNT while using GPU?

    • @CodeWithAarohi
      @CodeWithAarohi  Před rokem +1

      if your system has four GPUs and you want to utilize all of them, you would set GPU_COUNT to 4. On the other hand, if you only want to use a single GPU, you would set GPU_COUNT to 1.

    • @devavratpro7061
      @devavratpro7061 Před rokem

      @@CodeWithAarohi I am running your code using 600 images and each epoch is taking around 18 mins. I feel the model is not training through GPU. How to check it? I am running my code on a laptop with 16 GB RTX 3080ti.

    • @khanghaffar5295
      @khanghaffar5295 Před rokem

      @@devavratpro7061have u run it on gpu

  • @addisbelayneh1585
    @addisbelayneh1585 Před 3 lety

    thank you very much!!!
    Do you think that counting number of objects possible through mask RCNN?

  • @rajnigoyal4577
    @rajnigoyal4577 Před rokem

    mam how to resize the custom data as the model is not accepting the images

  • @vikashkumar-cr7ee
    @vikashkumar-cr7ee Před rokem

    Hey Aarohi, in real life deep learning study one can have thousands of images, so annotation has to be done manually or any special tool is available ?

    • @CodeWithAarohi
      @CodeWithAarohi  Před rokem

      You have to annotation yourself. There are Organizations who provide annotation services but those are paid services

  • @aboudezoa
    @aboudezoa Před 3 lety +2

    Very nice and detailed , maybe next video how to run it on Colab ?

  • @Sandhya_Bytes
    @Sandhya_Bytes Před 5 měsíci

    assert LooseVersion(keras.__version__) >= LooseVersion('2.0.8')
    ^^^^^^^^^^^^^^^^^
    AttributeError: module 'tensorflow.keras' has no attribute '__version__'
    Mam i am getting this error i have seen all resources but unable to rectify it please once look at this error please mam...................This error is occuring in model.py file

  • @jerryjohn1995
    @jerryjohn1995 Před 3 lety

    I think its better to share the screen than presenting using a projector

  • @ajaykushwah6793
    @ajaykushwah6793 Před 2 lety

    this is very nice tutorial mam. I have some questions, actually i m working on a project, in which i want to segment a particular object with the help of mask rcnn, opencv and raspberry pi 4, please guide me how to do it. i m new in the deep learing . thank you in advance

    • @CodeWithAarohi
      @CodeWithAarohi  Před 2 lety

      you can mail me at aarohisingla1987@gmail.com . I will try to help you

  • @Bushra_bushra99
    @Bushra_bushra99 Před 3 lety

    My annotation git other format of json and etch image has a his file json .. do how i Can use R-cnn with this ? Thanks dear

    • @CodeWithAarohi
      @CodeWithAarohi  Před 3 lety

      For Mask-RCNN , you need 1 json file which will have data of all the images in your training set. You can combine the data of all json files into 1 and can try.

  • @nithin7433
    @nithin7433 Před 5 měsíci

    How to do this if we have very large dataset ?

    • @CodeWithAarohi
      @CodeWithAarohi  Před 5 měsíci

      You have to annotate the entire dataset and follow the same steps which I mentioned in this video.

  • @farisabirafdi-6773
    @farisabirafdi-6773 Před 2 lety

    hello maam, thanks for the implementation. but, can you tell me the name of annotation aplication?

  • @siddhichaukade
    @siddhichaukade Před 3 lety +1

    Getting an error-
    TypeError: Could not build a TypeSpec for with type KerasTensor
    Can you please help?

    • @CodeWithAarohi
      @CodeWithAarohi  Před 3 lety

      share your code on my emailid

    • @lalinduwenasara2515
      @lalinduwenasara2515 Před 3 lety

      same here mam, I got exactly the same error. 😔" TypeError: Could not build a TypeSpec for with type KerasTensor "
      what was the reason for this? and I really love your tutorial series btw🧡

    • @siddhichaukade
      @siddhichaukade Před 3 lety

      @@CodeWithAarohi ok ma'am

    • @lalinduwenasara2515
      @lalinduwenasara2515 Před 3 lety

      i changed tensorflow_version to 1.x and now its working

    • @siddhichaukade
      @siddhichaukade Před 3 lety

      @@lalinduwenasara2515 Oh! Ok! I'll try that.

  • @ssagonline
    @ssagonline Před 3 lety

    I'm getting this error while training the model.
    I've been trying to go through the code step by step but errors keep popping up
    OperatorNotAllowedInGraphError: using a `tf.Tensor` as a Python `bool` is not allowed in Graph execution. Use Eager execution or decorate this function with @tf.function.

    • @CodeWithAarohi
      @CodeWithAarohi  Před 3 lety

      which tensorflow version and keras version you are using?

  • @hunnadazam6520
    @hunnadazam6520 Před 2 lety

    having error on load_custom() missing 1 required positional argument: 'subset'

  • @nishshankas.rodrigo335

    Nicely explained! Great job. Could I know wether we can just test this example on a computer with no GPU? Can run a simple maskrcnn algorithm on CPU?

    • @CodeWithAarohi
      @CodeWithAarohi  Před 3 lety +1

      Yes you can run on CPU

    • @nishshankas.rodrigo335
      @nishshankas.rodrigo335 Před 3 lety

      @@CodeWithAarohi thank you so much for your prompt response. Should I change anything in the code if I use only CPU? Like "images per GPU" or "GPU count"

    • @vikashkumar-cr7ee
      @vikashkumar-cr7ee Před rokem +1

      @@nishshankas.rodrigo335 was you able to run it on CPU? if yes, what changes have you made?

    • @nishshankas.rodrigo335
      @nishshankas.rodrigo335 Před rokem

      @@vikashkumar-cr7ee No. It didn't work and I gave up the attempt 😭

  • @viprasharma3048
    @viprasharma3048 Před 3 lety

    Hello maam.....I am getting error in tensorflow that no attribute placeholder . The version I am using is tensorflow 1.14.0 and keras is 2.0.5

  • @mrwarriorgaming3367
    @mrwarriorgaming3367 Před 2 lety

    Is this mask rcnn method is suitable to segment spine from spine xray image?

  • @datasciencewitharbaaz5221

    Hello Mam, what if we have our dataset huge. we cannot annotate each image in VGG tool, any other option for that ?.

    • @CodeWithAarohi
      @CodeWithAarohi  Před 2 lety

      Annotation required on all the images. You can use any annotation tool. There are organizations who provide AI powered annotation tools

  • @rakeshgnits
    @rakeshgnits Před 3 lety

    Madam I got error as "----> 1 model.train(dataset_train, dataset_val,
    2 learning_rate=config.LEARNING_RATE,
    3 epochs=10,
    4 layers='heads')
    5
    NameError: name 'model' is not defined" ....
    how to over come this error

    • @CodeWithAarohi
      @CodeWithAarohi  Před 3 lety

      you have to check the last 8-10 lines of your custom.py file. This error says that model is not defined.

  • @rakeshgnits
    @rakeshgnits Před 3 lety

    Madam first I thank you for clearly explaining MRCNN...when I tried to excuit I have got errors...then after seeing comment section...then I started installing python 3.6.8, tensor flow 1.14 and keras 2.2.5...and started executing...then I got error w.r.t to skimage...I tried pip install skimage...again got error... version not supporting...go for scikit image install...but even with that it is not working..so could you tell me how can I over come with this issue... trying to execute it from a week after I am sending this message... thanks in advance..

  • @hassansaid5230
    @hassansaid5230 Před rokem

    The idea was to train with own dataset (laptop, phone, tab) but you trained with other dataset (horse, man) , why?

  • @michelebianchi7861
    @michelebianchi7861 Před 2 lety

    I am a bit confused, are the validation images the same as the train images ? or a different set of annotated images? thank you.

  • @sakshibansal2488
    @sakshibansal2488 Před 2 lety

    Hello Ma'am.... Thank you soo much for this detailed explanation.
    But ma'am I have a doubt that we are annotating the train and Val images both and making separate json file for both of them but in this code you are using only the train json file.
    So do we have to copy the train json file in the Val folder or we have to make different json file with same name?
    Ma'am please respond as soon as possible... Its urgent.

  • @nezlana3475
    @nezlana3475 Před 3 lety

    thank u for the explanation, mam i want to know whether we can load the mask of images if its available in dataset . rather than generating the mask using the certain function in code

    • @nezlana3475
      @nezlana3475 Před 3 lety

      while doing with the code given , its showing the error : warning : you are using default load mask,may you need to define ur own one..................
      what to do for this kind

    • @CodeWithAarohi
      @CodeWithAarohi  Před 3 lety

      @@nezlana3475 this is just warning .. You can ignore this. This will not effect your code

    • @nezlana3475
      @nezlana3475 Před 3 lety

      @@CodeWithAarohi no mam, training results are not being shown ....its continuosly showing this error

    • @harinderkaur8320
      @harinderkaur8320 Před 2 lety

      @@nezlana3475 I am facing same problem...your problem is resolved or not ? If resolved plz help

  • @addisbelayneh1585
    @addisbelayneh1585 Před 2 lety

    hello Aarohi, I have tried to test the detection on my own dataset.
    There is no error but I got this message : "NO INSTANCE TO DISPLAY"
    I see instances but the detection are not good

    • @CodeWithAarohi
      @CodeWithAarohi  Před 2 lety +1

      This error means Algorithm is not detection anything . Increase the number of Epochs.

    • @addisbelayneh1585
      @addisbelayneh1585 Před 2 lety

      @@CodeWithAarohi ok i will try,
      thanks so much.

  • @loyaniloyani8565
    @loyaniloyani8565 Před 3 lety

    Thank you for the video. How do you convert the Mask RCNN model to TFLite and then deploy it on android device?

    • @CodeWithAarohi
      @CodeWithAarohi  Před 3 lety

      Welcome and I never tried on android device so right now no idea

    • @cspassionate9665
      @cspassionate9665 Před 3 lety

      You can use converter= tflite.TFLiteConverter.from_keras_model(keras_model)
      keras_model=model.keras_model
      tfmodel=converter.convert()
      To convert model to tflite.

  • @betulsinar8488
    @betulsinar8488 Před 3 lety

    Hi Aarohi, what is the size in json file? We try to getting custom json with code but we couldn't understand what refer to 'size' info

  • @rammohanbethi
    @rammohanbethi Před 3 lety

    Getting an Error:
    I'm working on my own dataset, and i followed same steps but got an error
    Traceback (most recent call last):
    File "custom.py", line 201, in
    train(model)
    File "custom.py", line 167, in train
    dataset_train.load_custom(r"D:/Rammohan/AI ML Projects/Mask RCNN/dataset","train")
    File "custom.py", line 97, in load_custom
    polygons = [r['shape_attributes'] for r in a['regions']]
    File "custom.py", line 97, in
    polygons = [r['shape_attributes'] for r in a['regions']]
    TypeError: string indices must be integers
    Can I get dataset which you have have prepared???

  • @Krebas92
    @Krebas92 Před 2 lety

    Excellent video! Is there a way to save the masks encountered by the model in any vector or raster formats?
    thanks in advance :)

  • @parkerlieu4832
    @parkerlieu4832 Před 3 lety

    If we got the pre-trained COCO weight , can we use already COCO labels plus with our custom labels ??? Thank you

    • @CodeWithAarohi
      @CodeWithAarohi  Před 3 lety

      yes you can do that.

    • @parkerlieu4832
      @parkerlieu4832 Před 3 lety

      @@CodeWithAarohi sorry but how we can add classes of COCO dataset in testing code ?
      we add to by
      self.add_classes ???
      Ex:
      self.add_class("object", 1, "laptop")
      self.add_class("object", 2, "phone")
      self.add_class("object", 3, "tab")
      self.add_class("object", 4, "bag")
      Is it right
      Thank you

  • @metaLeap
    @metaLeap Před 3 lety

    Hello Ma'am, I followed the image annotation process as it was shown, in my case though I have only one type of object to identify but after downloading the json file , the name of id isn't showing up for the region_attributes, for eg looks like this: "region_attributes":{}}, though the shape attributes are coming as shown, what could be the reason for this?

    • @CodeWithAarohi
      @CodeWithAarohi  Před 3 lety +1

      your json file is blank. There must be some problem while doing the annotation. try to do it again. You might have missed something. Check the process in the video properly and try again. If you still gets blank file after that then I will help you

  • @KhulnaDevelopmentAuthority

    Mam , when I try to run this code I am getting error. I tried different versions of tensorflow and keras but didn't find any solution. I also tried tensorflow==1.14.0 and keras ==2.0.8 but getting too many errors. could you please make a environment setup video? it will be very helpful .

    • @CodeWithAarohi
      @CodeWithAarohi  Před 3 lety

      You can try with tensorflow 1.14.1 and keras 2.3.0

    • @angelospapadopoulos7679
      @angelospapadopoulos7679 Před 2 lety

      prerequisites:
      1)Tensorflow 1.15.2
      2)Keras 2.3.1
      3)h5py < 3.0.0 so 1.21.5 (!pip install 'h5py

  • @riyajatar6859
    @riyajatar6859 Před 2 lety

    Can you make some videos on mmdetection toolbox ?
    It's has good collection of detection models.

    • @CodeWithAarohi
      @CodeWithAarohi  Před 2 lety

      Noted! Will try to do after finishing my pipelined videos

  • @shahzebimtiaz1849
    @shahzebimtiaz1849 Před 3 lety

    I've tried tf version 1.14.0 and keras==2.3.0 but come up with this error when I run the custom.py file
    AttributeError: module 'tensorflow._api.v1.compat.v2.compat' has no attribute 'v1'
    I tried installing tf 1.14.1 as you are using but it said only 1.14.0 or 1.14.0rc1 exists.
    Can you tell what might be wrong? I have changed the GPU count to 0 in config file as well as I don't have a GPU in my machine.
    would appreciate any help

    • @CodeWithAarohi
      @CodeWithAarohi  Před 3 lety +1

      Create a separate environment. And the python version I am using python 3.6.8, tensorflow 1.15.0, keras 2.2.5 and h5py version 2.10.0 . This mask rcnn code will work with these versions

    • @shahzebimtiaz1849
      @shahzebimtiaz1849 Před 3 lety

      @@CodeWithAarohi thanks it resolved the issue that I posted above. However now i'm facing this error:
      objects = [s['region_attributes']['names'] for s in a['regions']]
      KeyError: 'names'
      line 98 of cutom.py file, Previously I set it as 'name' as in your video but the same error came. I changed it to names as in the VGG annotator tools you had defined 'names' in region attributes and not 'name'. Can you tell what might be the possible reason of this error :(

  • @hassanbinali1999
    @hassanbinali1999 Před 2 lety

    Thank you for your efforts. I have made my custom dataset and run the code successfully.
    I have almost 12 images altogether, but the training process get stuck in the first epoch. After waiting for more than 2 hours, a folder got created in the "logs" directory but it contains a file with a really weird name and extension. "events.out.tfevents.1659180925.dfd413d54739" is the file. I have tried different methods to somehow convert it to .h5 but failed.
    Any kind of help will be highly appreciated.

    • @CodeWithAarohi
      @CodeWithAarohi  Před 2 lety

      We are working using tensorflow and this file is created by FileWriters and are generally used to store summary output. You can later delete it. But this is not your stored model. Start your training again and wait until you get the .h5 file. You will get the .h5 file when training starts ( you will see epochs execution on your screen).

    • @hassanbinali1999
      @hassanbinali1999 Před 2 lety

      @@CodeWithAarohi Thank you so much ma'am.

  • @adnanchrimni4607
    @adnanchrimni4607 Před 3 lety

    Hellow, I ran the program on an anaconda environment (Vscode), but I don't know how to get the final image of my program, can you show me how?

    • @CodeWithAarohi
      @CodeWithAarohi  Před 3 lety

      please explain me the problem which you are facing.

    • @adnanchrimni4607
      @adnanchrimni4607 Před 3 lety

      @@CodeWithAarohi taking your example on jupyter, at the end of the running of the program, at the bottom, you have the image of the phone + laptob +tab, how can we have this final image with anaconda on VS code

  • @Syazaniwhd
    @Syazaniwhd Před rokem

    Hi may I know which python version are you running on

  • @seetharamnageshappe5013

    Thank you for the explanation. Whne I am trying mask rcnn on custom dataset I am getting th error: class ProposalLayer(KE.Layer):
    AttributeError: module 'keras.engine' has no attribute

    • @CodeWithAarohi
      @CodeWithAarohi  Před 3 lety

      try to use keras version 2.3.0

    • @seetharamnageshappe5013
      @seetharamnageshappe5013 Před 3 lety +1

      @@CodeWithAarohi AttributeError: module 'tensorflow._api.v1.compat.v2.compat' has no attribute 'v1' when using keras 2.3.0

    • @shahzebimtiaz1849
      @shahzebimtiaz1849 Před 3 lety

      @@seetharamnageshappe5013 any luck resolving this problem? I am facing the same issue

    • @seetharamnageshappe5013
      @seetharamnageshappe5013 Před 3 lety

      @@shahzebimtiaz1849Yes, I am able to resolve it by installing !pip install keras==2.1.0
      %tensorflow_version 1.x
      !pip install h5py==2.10.0
      and then started cloning git repository.
      Try with this.

    • @shahzebimtiaz1849
      @shahzebimtiaz1849 Před 3 lety

      @@seetharamnageshappe5013 are you running it on colab?

  • @rakeshgnits
    @rakeshgnits Před 3 lety

    madam do I have to take same images for 'val' which i have taken in 'train'...or it should be different...i have taken different images i got error .....then i have taken some of images in val same as train.... for then it is not showing error........but now again it show error........
    FileNotFoundError: [Errno 2] No such file or directory: 'C:\\MaskRCNN\\Dataset\\val\\bu103.jpg'.....because this bu103 is there in train but not in val.....thanks in advance madam.

    • @CodeWithAarohi
      @CodeWithAarohi  Před 3 lety

      This error is because it is only reading images of train folder because we have mention the json file path of train folder. Make few changes in custom.py so that it will read all the images from train and val folder 1 by 1.

    • @rakeshgnits
      @rakeshgnits Před 3 lety

      Thank you madam

    • @rakeshgnits
      @rakeshgnits Před 3 lety

      @@CodeWithAarohi madam do we have to add json file of validation in annotations1
      "dataset_dir = os.path.join(dataset_dir, subset)
      annotations1 = json.load(open".....
      i have followed your both MRCNN videos but in that both codes no where mentioned about validation json file.....pls help help me in this regard thank you

    • @CodeWithAarohi
      @CodeWithAarohi  Před 3 lety

      @@rakeshgnits yes right. Use if else statement and read both the annotation files one by one in annotation1 variable

    • @ritusingh6855
      @ritusingh6855 Před 3 lety

      @@rakeshgnits were you able to resolve the issue?

  • @nailashah6918
    @nailashah6918 Před 3 lety

    Is there no need of jupitor notebook to run our mask rcnn code?

  • @kasatiti
    @kasatiti Před 3 lety

    Where can I find the next video for testing?

  • @geethaneya2452
    @geethaneya2452 Před 3 lety

    You explained very deeply super. Mam we can run this code in colab as it is, because I don't have gup. To run in colab let me know how to do. Please

    • @CodeWithAarohi
      @CodeWithAarohi  Před 3 lety

      Yes you can run this code on colab. There are steps available. You can follow the steps given here: www.analyticsvidhya.com/blog/2020/03/google-colab-machine-learning-deep-learning/

    • @geethaneya2452
      @geethaneya2452 Před 3 lety

      Thank u

    • @devshetty1435
      @devshetty1435 Před 3 lety

      @@geethaneya2452 Hi did the code work for you on Collab??

  • @seetharamnageshappe5013

    ImportError: cannot import name 'get_config' from 'tensorflow.python.eager.context' (/usr/local/lib/python3.7/dist-packages/tensorflow/python/eager/context.py). im getting this error when running mask rcnn in colab

    • @CodeWithAarohi
      @CodeWithAarohi  Před 3 lety

      this code will work on tensorflow 1.13 or 1.14 . Check your tensorflow version

    • @seetharamnageshappe5013
      @seetharamnageshappe5013 Před 3 lety

      @@CodeWithAarohi thank you

    • @seetharamnageshappe5013
      @seetharamnageshappe5013 Před 3 lety

      21 from mrcnn.visualize import display_images
      22 from mrcnn.visualize import display_instances
      ---> 23 import mrcnn.model as modellib
      24 from mrcnn.model import log
      25 from mrcnn.config import Config
      /content/Mask_RCNN/mrcnn/model.py in ()
      253
      254
      --> 255 class ProposalLayer(KE.Layer):
      256 """Receives anchor scores and selects a subset to pass as proposals
      257 to the second stage. Filtering is done based on anchor scores and
      AttributeError: module 'keras.engine' has no attribute 'Layer'

  • @devshetty1435
    @devshetty1435 Před 3 lety

    Hello Ma'am
    I have 7 category but the JSON file is seperat for each class how should we train the data in such case?
    Ma'am and each category have 1000 -1000 images in it??
    Ma'am and at NUM_CLASSES= 1+ a
    a=7 if I have 7 category right??
    And ma'am do we need to create logs file ?
    Or it will be created automatically while running??

    • @CodeWithAarohi
      @CodeWithAarohi  Před 3 lety

      Hi, Log file will get created itself. And you are right about class concept. Good Keep it up

    • @devshetty1435
      @devshetty1435 Před 3 lety

      @@CodeWithAarohi Thank You Ma'am
      Ma'am I had one more question regarding which version of tensor flow and keras is required

    • @devshetty1435
      @devshetty1435 Před 3 lety

      @@CodeWithAarohi And ma'am I have 7 category but in 7 different JSON files so do I need to combine them?

  • @adityarajaramhegde2746

    Which Tensorflow, Kerasa, Python version is suitable ?

    • @CodeWithAarohi
      @CodeWithAarohi  Před 3 lety +1

      Tensorflow 1.14.1, keras 2.3.0 and python 3.6.8

  • @siddhichaukade
    @siddhichaukade Před 3 lety

    I want to create a model which identifies whether a car is damaged or not... I have got a dataset which contains separate folders of damaged cars and cars which are not damaged. So is the initial annotation necessary for this dataset? because, here every photo contains only one object.

    • @CodeWithAarohi
      @CodeWithAarohi  Před 3 lety

      Yes you need to annotate for single object also.

    • @siddhichaukade
      @siddhichaukade Před 3 lety

      @@CodeWithAarohi oh okay... Thankyou! I had few more doubts... Can I contact you via some way? Your video is a saviour ...! Thanks a lot for this!

    • @CodeWithAarohi
      @CodeWithAarohi  Před 3 lety

      @@siddhichaukade sure you can mail me aarohisingla1987@gmail.com

    • @siddhichaukade
      @siddhichaukade Před 3 lety

      @@CodeWithAarohi ok thankyou once again...!

    • @CodeWithAarohi
      @CodeWithAarohi  Před 3 lety

      @@siddhichaukade welcome

  • @sharathchandra4727
    @sharathchandra4727 Před 3 lety

    TypeError: Could not build a TypeSpec for with type KerasTensor
    Can you solve me this error......

  • @seetharamnageshappe5013

    MAdam How to calculate Accuracy and Confusion matrix for mask rcnn

    • @CodeWithAarohi
      @CodeWithAarohi  Před 3 lety

      You need to write a separate function for calculating confusion matrix and MAP. Will cover this in my next video of Mask RCNN

    • @seetharamnageshappe5013
      @seetharamnageshappe5013 Před 3 lety

      @@CodeWithAarohi Thank you. When you are going to post the next video to calculate accuracy

  • @ummugulsumzengin792
    @ummugulsumzengin792 Před 2 lety

    it's not moving beyond step1/10 of epoch

    • @CodeWithAarohi
      @CodeWithAarohi  Před 2 lety

      sometime it takes time. It is due to to resources you are using for training. What is your PC Configuration

    • @ummugulsumzengin792
      @ummugulsumzengin792 Před 2 lety

      l changed the keras and tensorflow versiyons and l rewrote the code because l guess l made mistakes in the code . Then the training started. Yes , it tooked time . As you said , it is due to the PC configuration l am using.
      Ram 8GB
      Process Intel i5
      GPU NIVIDA GeForce GTX 1650 Ti
      I am using gpu for training . Thank you for your time hocam .

  • @vikashkumar-cr7ee
    @vikashkumar-cr7ee Před rokem

    numpy version ?

  • @shahzebimtiaz1849
    @shahzebimtiaz1849 Před 3 lety

    Can we implement this if we have no GPU in our machine?

    • @CodeWithAarohi
      @CodeWithAarohi  Před 3 lety +1

      yes, you can use it. For more details: you can check config.py file under mrcnn folder. See line number 27 and 28.

    • @shahzebimtiaz1849
      @shahzebimtiaz1849 Před 3 lety

      @@CodeWithAarohi thanks Aarohi for your prompt reply.