Mask R-CNN Practical Implementation

  Рет қаралды 59,532

Code With Aarohi

Code With Aarohi

Күн бұрын

Пікірлер: 356
@CodeWithAarohi
@CodeWithAarohi 9 ай бұрын
This code is tested on Python 3.8.0, tensorflow 2.4.0, keras 2.3.1 and h5py 2.10.0
@TechTravel_with_MAC
@TechTravel_with_MAC Ай бұрын
I already tried this version but google colab by default take 3.8.20 not 3.8.0 And then I process this tenserflow and keras version but still I am getting of other requirement version problem which was not working in this version --can u share your env setup
@borradurgasree6786
@borradurgasree6786 Ай бұрын
@@TechTravel_with_MAC did you get solution, please share it in comment box
@ImtiazAli-fc2fo
@ImtiazAli-fc2fo 3 ай бұрын
I am in USA and working on imaging. I appreciate you highly. You did a great job. Excellent
@CodeWithAarohi
@CodeWithAarohi 3 ай бұрын
Thank you so much 😀
@rajatvardam2787
@rajatvardam2787 2 жыл бұрын
Mam your videos are very on-point, easy to understand and implement. Your previous videos helped me as well just like how this video helped me now. You are doing a good work. Thankyou.
@CodeWithAarohi
@CodeWithAarohi 2 жыл бұрын
Glad to hear that 😊
@student747
@student747 3 жыл бұрын
YOU ARE THE BEST WOMAN IN THE WORLD!)))
@sanjayankali7006
@sanjayankali7006 8 ай бұрын
very neat, clear, and simple explanation.. Keep it up madam
@CodeWithAarohi
@CodeWithAarohi 8 ай бұрын
Thank you so much 🙂
@DeathlessLife786
@DeathlessLife786 Жыл бұрын
A very clear explanation mam.. Thanks a lot...Live long ....
@CodeWithAarohi
@CodeWithAarohi Жыл бұрын
Glad my video is helpful!
@DeathlessLife786
@DeathlessLife786 Жыл бұрын
Hi Mam, I have completed all steps what u have taught in your tutorial. Actually i want to mask liver from CT image. So I have created two classes for Liver and Spleen using CT image. ( The python is installed in C drive anf my project is stored in the path C:\New_project_mask_rcnn) Finally i got the following in the output window.......... objects: ['liver'] numids [1] objects: ['spleen'] numids [2] objects: ['liver'] numids [1] objects: ['liver'] numids [1] Traceback (most recent call last): File "C:\New_project_mask_rcnn\custom.py", line 167, in dataset_val.load_custom(r'C:\New_project_mask_rcnn\Dataset',"val") File "C:\New_project_mask_rcnn\custom.py", line 103, in load_custom image = skimage.io.imread(image_path) File "C:\Users\HP\AppData\Local\Programs\Python\Python36\lib\site-packages\skimage\io\_io.py", line 48, in imread img = call_plugin('imread', fname, plugin=plugin, **plugin_args) File "C:\Users\HP\AppData\Local\Programs\Python\Python36\lib\site-packages\skimage\io\manage_plugins.py", line 209, in call_plugin return func(*args, **kwargs) File "C:\Users\HP\AppData\Local\Programs\Python\Python36\lib\site-packages\skimage\io\_plugins\imageio_plugin.py", line 10, in imread return np.asarray(imageio_imread(*args, **kwargs)) File "C:\Users\HP\AppData\Local\Programs\Python\Python36\lib\site-packages\imageio\core\functions.py", line 159, in imread with imopen(uri, "ri", plugin=format) as file: File "C:\Users\HP\AppData\Local\Programs\Python\Python36\lib\site-packages\imageio\core\imopen.py", line 161, in imopen request = Request(uri, io_mode, format_hint=format_hint) File "C:\Users\HP\AppData\Local\Programs\Python\Python36\lib\site-packages\imageio\core equest.py", line 248, in __init__ self._parse_uri(uri) File "C:\Users\HP\AppData\Local\Programs\Python\Python36\lib\site-packages\imageio\core equest.py", line 388, in _parse_uri raise FileNotFoundError("No such file: '%s'" % fn) FileNotFoundError: No such file: 'C:\New_project_mask_rcnn\Dataset\val\image1.jpg' ------------------------------------------------------------------------------ In the valitation folder named "val" The image1 is a picture stored in Training folder named as "train". i donot have stored any image with name image1. ------------------------------------------------------------------------------------ How do solve this issue? Please guide me mam...
@sunilyadav-i3t4u
@sunilyadav-i3t4u 29 күн бұрын
i also got same issue. please reply how to solve the issue.
@rupakdey6753
@rupakdey6753 3 жыл бұрын
The explanation from the previous video and the implementation in this video is too good ❤️. Keep up the good work mam ❤️Try to make videos on Big Data too 😊🙏
@CodeWithAarohi
@CodeWithAarohi 3 жыл бұрын
Thank you, I will make videos on Big data
@senthamilselvirajavel
@senthamilselvirajavel 5 ай бұрын
good evening mam..your teaching is more excellent mam..kindly upload this implementation of mask rcnn in colab platform mam..so that it can very much useful for our students mam...thank you so much for your excellent effort mam..
@CodeWithAarohi
@CodeWithAarohi 5 ай бұрын
Hi, Follow this process to run the code in colab. Just paste this entire code folder in your google drive. Then the code which I wrote in custom.py file, paste it in the colab and run. Make sure to select the GPU from notebook settings. Also, make sure to change the paths in custom.py file code when you paste it in colab. You can ask me queries if you face any problems while running on colab.
@anonnymous3440
@anonnymous3440 2 жыл бұрын
Amazing explaination. Super helpful; thank you!
@CodeWithAarohi
@CodeWithAarohi 2 жыл бұрын
Glad it was helpful!
@soravsingla6574
@soravsingla6574 Жыл бұрын
Wow. Very nicely explained
@CodeWithAarohi
@CodeWithAarohi Жыл бұрын
Glad you liked it
@laurangome5016
@laurangome5016 3 жыл бұрын
thank you so much you dont how much you are helping me right now God bless you
@CodeWithAarohi
@CodeWithAarohi 3 жыл бұрын
Glad to hear that!
@manoharnookala4212
@manoharnookala4212 3 жыл бұрын
Hi Arohi, at 5:53 minutes, you told we need draw line on object. if i have 1 lac images then do i need to mask all the images or else only for few?
@CodeWithAarohi
@CodeWithAarohi 3 жыл бұрын
Yes you have to do annotations for all the images
@manoharnookala4212
@manoharnookala4212 3 жыл бұрын
@@CodeWithAarohi Then how it works in the live video??
@sangavisivanandham2737
@sangavisivanandham2737 3 жыл бұрын
@@manoharnookala4212 same doubt ... how we can annotate n number of files??
@bhatiapkaur
@bhatiapkaur 2 жыл бұрын
@@sangavisivanandham2737 have you got any solution to this, if i have a large dataset then how to do annotations for all images?
@dariodellamura64
@dariodellamura64 3 жыл бұрын
Hi Aarohi, I have a question to ask: how can the total IOU be calculated for each single class to be predicted? Thanks for your deep learning videos.
@bayualiffarisqi3251
@bayualiffarisqi3251 2 жыл бұрын
hai ma'am i have error in may program after training, the error like this UnboundLocalError: local variable 'image_id' referenced before assignment
@BhajansAshwin
@BhajansAshwin 3 жыл бұрын
Thanks!
@CodeWithAarohi
@CodeWithAarohi 3 жыл бұрын
Welcome :)
@lorenzoleongutierrez7927
@lorenzoleongutierrez7927 2 жыл бұрын
Hello Aarohi (perhaps this is some basic, sorry.) . I'm following this and other tutorials and I would appreciate an orientation on how to create the environment for running this code (as the one you use from min 20:00 onwards). I'm searching an (*.yml) file with the specs on the repo... but in can't find it. thanks in advance!
@CodeWithAarohi
@CodeWithAarohi 2 жыл бұрын
Install python 3.6.8, then install tensorflow 1.15 , keras 2.2.4, h5py 2.10.0
@lorenzoleongutierrez7927
@lorenzoleongutierrez7927 2 жыл бұрын
@@CodeWithAarohi Okay, Ill do that , thanks a lot!
@pavaramanupriya4457
@pavaramanupriya4457 3 жыл бұрын
Thank you so much❤ This video helps me a lot to complete my research.
@CodeWithAarohi
@CodeWithAarohi 3 жыл бұрын
Glad it was helpful!
@alakanandamishra4242
@alakanandamishra4242 2 жыл бұрын
Thanks Mam for your valuable guidance. I have few queries: 1. I have implemented it as per your steps but test performance is very poor. What should be the training strategy for improved performance? 2. Min. Epochs required on COlab?. How can I run on video?
@chun-julee6942
@chun-julee6942 3 жыл бұрын
Great job, Ma'am!!
@CodeWithAarohi
@CodeWithAarohi 3 жыл бұрын
Thank you! 😊
@prodbyryshy
@prodbyryshy Жыл бұрын
i might need to implement mask r cnn for 3D image stacks, havent found any good implementations yet, was wondering how hard it would be to achieve this
@themlexpert_
@themlexpert_ Жыл бұрын
This is a great video illustrating the MRCNN implementation. Currently, im working on a project and im trying to visualize the top masks of random images in my training dataset and the top masks are showing distortion. I went back a few steps to print out the masks in from the for loop of image_ids and i got a bunch of arrays of false as output. Im not sure why im getting false as output.
@ApekshaAlavandi
@ApekshaAlavandi 4 ай бұрын
i want to train Mask-RCNN on python 3.9.7 ..please can you share the requirements.txt?
@juanej7
@juanej7 3 жыл бұрын
You're amazing 👏, thank you!
@CodeWithAarohi
@CodeWithAarohi 3 жыл бұрын
Happy to help!
@tech4tomorrow
@tech4tomorrow Жыл бұрын
mam how one can get the train data as images rather than json file. and if I want to add some new classes example glass then how it is possible plz make video on that.
@dr.sanjayankali3410
@dr.sanjayankali3410 7 ай бұрын
Thank you mam.. But if I keep different images then during inference mode it shows run time error about as image not found
@dr.sanjayankali3410
@dr.sanjayankali3410 7 ай бұрын
It works fine only if there are same images in train and Val folder madam
@salmanahmed3938
@salmanahmed3938 Жыл бұрын
please make the video on the HAM10000 dataset for skin lesion that how to import this dataset and use it.
@DeathlessLife786
@DeathlessLife786 Жыл бұрын
Do i want to generate separate coco weight file for different images like CT, MRI..etc..?
@CodeWithAarohi
@CodeWithAarohi Жыл бұрын
You need a single json file for all your training images. Ans there can be more than 1 class in your training dataset.
@Wisemonk24
@Wisemonk24 2 жыл бұрын
indebted to you maam .
@CodeWithAarohi
@CodeWithAarohi 2 жыл бұрын
Glad my video is helpful :)
@altafsarfraz526
@altafsarfraz526 2 жыл бұрын
Thanks a lot ma'am for your guidance. Ma'am in your test_truck_car_model.ipynb notebook.... Is the Confusion matrix code In the last cell working correctly?
@CodeWithAarohi
@CodeWithAarohi 2 жыл бұрын
Yes, it is working
@shimajafari5590
@shimajafari5590 3 ай бұрын
hi, thank you for your helpful video; i jae a question , hope you can give me a guide. i tried to apply this code, first it was the problem of tensorflow 1x version not being abled in colab, then i made a virtual env using lower python version and using tensorflow 1x , it appeared with other errors such as skimage and code being old! i wish you have sth for me to do it,,, the other help that i want is about models detecting polygon with polygon annotations; i want to detect polygon lables exactly as polygons, not as bounding boxes (when the model detect my thing, it shows it as a polygon label not a bounding box label), do you have any clue for me? or do you know on which models should i work? i'll be so thankful anyway💕💕
@CodeWithAarohi
@CodeWithAarohi 3 ай бұрын
You can perform instance segmentation with other models also like YOLO11. Here is a tutorial: kzbin.info/www/bejne/iaiqanWJjK6jeNU
@sushantparajuli611
@sushantparajuli611 4 ай бұрын
Why did you copy the same datasets in both folders; train and val? Is this a correct approach? Could you give some insights? In my opinion, we should split the datasets into train and validation. Or?
@CodeWithAarohi
@CodeWithAarohi 4 ай бұрын
You need to put the different set of images in train, val and test.
@biplabdas8635
@biplabdas8635 2 жыл бұрын
Ma'am can you tell us where we need to see accuracy in the training
@gowithgaurav9617
@gowithgaurav9617 Жыл бұрын
Hello ma'am, You have explained really well but when we do data augmentation for example flip,or rotate than our original annotations position will also be changed? For example if I annotate a building which is on right side than if we do augmentation of flip than the building will be augmented on left side does the annotation also change its position?how does it work? Please explain
@CodeWithAarohi
@CodeWithAarohi Жыл бұрын
You can do this : # model.train(dataset_train, dataset_val, # learning_rate=config.LEARNING_RATE, # epochs=600, # layers='heads', #layers='all', # augmentation = imgaug.augmenters.Sequential([ # imgaug.augmenters.Fliplr(1), # imgaug.augmenters.Flipud(1), # imgaug.augmenters.Affine(rotate=(-45, 45)), # imgaug.augmenters.Affine(rotate=(-90, 90)), # imgaug.augmenters.Affine(scale=(0.5, 1.5)), # imgaug.augmenters.Crop(px=(0, 10)), # imgaug.augmenters.Grayscale(alpha=(0.0, 1.0)), # imgaug.augmenters.AddToHueAndSaturation((-20, 20)), # change hue and saturation # imgaug.augmenters.Add((-10, 10), per_channel=0.5), # change brightness of images (by -10 to 10 of original value) # imgaug.augmenters.Invert(0.05, per_channel=True), # invert color channels # imgaug.augmenters.Sharpen(alpha=(0, 1.0), lightness=(0.75, 1.5)), # sharpen images # ] # ))
@gowithgaurav9617
@gowithgaurav9617 Жыл бұрын
@@CodeWithAarohi yes this I know but what I am actually asking is what about the annotation i.e the mask?When for example an image is fliped, will the ground truth polygon from the json file i.e the cordinates for the particular instance in the image also fliped? Because if the image is fliped, then the instance is in another position, right?how to do this? I would appreciate your answer.
@CodeWithAarohi
@CodeWithAarohi Жыл бұрын
Mask R-CNN does not automatically handle updating the annotations when applying transformations to the images. We have to do it manually. Detectron2 or TensorFlow's Object Detection API, provide functionalities for data augmentation and automatically handle updating the annotations when applying transformations to the images. Below is an example of a custom Python code that uses the popular library imgaug for image augmentation and creates new annotations for the corresponding augmented images in the context of Mask R-CNN. pip install imgaug import imgaug.augmenters as iaa import numpy as np import cv2 # Function to apply horizontal flipping to the image and annotations def flip_image_and_annotations(image, bounding_boxes, segmentation_masks): # Create an augmenter for horizontal flipping flipper = iaa.Fliplr(1.0) # Apply the flip augmentation to the image flipped_image = flipper.augment_image(image) # Get image width for calculating new bounding box coordinates image_width = image.shape[1] # Flip bounding boxes flipped_bounding_boxes = [] for box in bounding_boxes: x_min, y_min, x_max, y_max = box x_min_flipped, x_max_flipped = image_width - x_max, image_width - x_min flipped_bounding_boxes.append([x_min_flipped, y_min, x_max_flipped, y_max]) # Flip segmentation masks flipped_segmentation_masks = [] for mask in segmentation_masks: # Assuming segmentation masks are binary (0 for background, 1 for object) flipped_mask = np.fliplr(mask) flipped_segmentation_masks.append(flipped_mask) return flipped_image, flipped_bounding_boxes, flipped_segmentation_masks # Example usage if __name__ == "__main__": # Load the original image, bounding boxes, and segmentation masks original_image = cv2.imread("path_to_original_image.jpg") original_bounding_boxes = [[50, 100, 150, 200]] # Example format: [x_min, y_min, x_max, y_max] original_segmentation_masks = [np.ones((original_image.shape[0], original_image.shape[1]))] # Apply augmentation and get augmented image, bounding boxes, and masks augmented_image, augmented_bounding_boxes, augmented_segmentation_masks = flip_image_and_annotations( original_image, original_bounding_boxes, original_segmentation_masks ) # Save the augmented image and annotations or use them for training Mask R-CNN cv2.imwrite("path_to_save_augmented_image.jpg", augmented_image) print("Augmented Bounding Boxes:", augmented_bounding_boxes) print("Augmented Segmentation Masks:", augmented_segmentation_masks) In this example, we used imgaug to implement horizontal flipping. You can similarly add other augmentation techniques or combine multiple augmenters from the imgaug library to perform a wide range of data augmentation.
@fredbaafi9013
@fredbaafi9013 2 жыл бұрын
Hi Aarohi, that's a very good explanation, but how do you count the class when you want to detect a car and a number plate? Should one call car as class 1 and number plate as class 2?
@Sandhya_Bytes
@Sandhya_Bytes 10 ай бұрын
Mam in which file i have to perform preprocessing techniques mam Please reply mam??
@rafif6617
@rafif6617 2 жыл бұрын
Hi Aarohi, i have a question. so, from this line: annotations1 = json.load(open('D:\\env_with_tensorflow1.14\\all_maskrcnn\\maskrcnn_truck_car\\Dataset\\train\\train_json.json')) my understanding is that we only use the training annotations. so how do we us the val annotations? or when? because I didn't see it called. Thank you
@CodeWithAarohi
@CodeWithAarohi 2 жыл бұрын
You can use if else statement and can call train.json from train and val folder.
@MSCAIMLRBRITHANYA
@MSCAIMLRBRITHANYA Жыл бұрын
mam what if i have different json file from each images? how do i train a mask rcnn
@angelospapadopoulos7679
@angelospapadopoulos7679 2 жыл бұрын
on the mean average precision i get this error: AttributeError: module 'utils' has no attribute 'gt_pred_lists' even though the utils has this attribute, i don't get it!
@RanjaniAnbalagan-nl4gu
@RanjaniAnbalagan-nl4gu 5 ай бұрын
mam the object that i wanted to detect is not there in pretrained models in that case,how would i get cocoweights?.should i necessarily use coco weights? what would i do otherwise? pls guide mam
@CodeWithAarohi
@CodeWithAarohi 5 ай бұрын
If the object you want to detect is not in pretrained weights then collect images related to your custom object, annotate those images in the format which Mask R-CNN accepts. Then train your model on that custom dataset. You can train in 2 ways- 1- Train the model from scratch. 2- Use pretrained model and then fine tune it with you custom dataset.
@RanjaniAnbalagan-nl4gu
@RanjaniAnbalagan-nl4gu 5 ай бұрын
Thankyou mam for your concern to take time and reply.one more doubt mam,can i annotate objects after zooming it,,will it cause any performance variation when i use that model in online..can you please tag video on training a model from scratch using mask rcnn.
@unggulprabowo1045
@unggulprabowo1045 3 жыл бұрын
Amazing sis
@CodeWithAarohi
@CodeWithAarohi 3 жыл бұрын
Thanks 😊
@devendrakoribilli7441
@devendrakoribilli7441 Жыл бұрын
Mam !!! how many images should be trained to get an accurate object detection output to detect grapes?
@CodeWithAarohi
@CodeWithAarohi Жыл бұрын
The number of images required to train an accurate object detection model for grapes can vary depending on several factors such as the complexity of the grape images, the number of classes to be detected (e.g., green grapes, red grapes), the quality of the images, and the desired level of accuracy. In general, a good rule of thumb is to have at least 400-500 hundred training images
@subhajitrakshit9866
@subhajitrakshit9866 3 жыл бұрын
Hi Aarohi, many thanks for the explanation..one thing--> why we need to choose latest epoch? may be your 2nd last epoch or some epoch in middle could give you min loss value compare to all others right??
@CodeWithAarohi
@CodeWithAarohi 3 жыл бұрын
Hi, you can choose any weight file as per model performance
@vishalpahuja2967
@vishalpahuja2967 Жыл бұрын
for setting enviornment can you provide specifications you have used. Thank you.
@CodeWithAarohi
@CodeWithAarohi Жыл бұрын
python 3.6.8, tensorflow 1.14.0, keras 2.3.0, h5py version 2.10.0
@prashanthabib452
@prashanthabib452 2 жыл бұрын
Hello Mam, Thanks for your good explanation and detailed video. One doubt here : is it necessary that the number of images in the train and val folders be same ? Or in the JSON file? As the "annotations" variable is calculating nubmer of indexes from the train.json file. And i am also getting the error for the same saying that , val.json cannot find some files when number of images are different in train and val folder. However when i careful checked in your video that is not the case. Thanks.
@CodeWithAarohi
@CodeWithAarohi 2 жыл бұрын
Number of images can be different in train and val folder. Just have the json file of train and val folder with a same name then use if else condition to read train and val json file
@farellfahroziofficial
@farellfahroziofficial 3 жыл бұрын
hiii mam, My Proggram AttributeError: module 'keras.engine' has no attribute 'Layer' , can you please help me mam?
@farellfahroziofficial
@farellfahroziofficial 3 жыл бұрын
I use Tensorflow version 2.2
@CodeWithAarohi
@CodeWithAarohi 3 жыл бұрын
Use Tensorflow 1.14 and keras 2.3.0
@andianzanulzikra5729
@andianzanulzikra5729 2 жыл бұрын
how to display matrix, and accuracy?
@mrfusion_ad
@mrfusion_ad Жыл бұрын
Mem one error occurred during execution of train(model) the AttributeError: SGD' object has no attribut How to resolve the issue
@CodeWithAarohi
@CodeWithAarohi Жыл бұрын
please provide additional context and code related to the error you are encountering
@captainofthewhitetower
@captainofthewhitetower 6 ай бұрын
How can we show this on like Vscode using python?
@MuhammadRashid-hu3wo
@MuhammadRashid-hu3wo Жыл бұрын
Hi Arohi, Can you please tell me which Python, tensorflow and keras version you used?
@CodeWithAarohi
@CodeWithAarohi Жыл бұрын
Here, I have used tensorflow 1.x but if you want to work with tensorflow 2.x then check this video: kzbin.info/www/bejne/h4Gcf59jo9xrb5I
@nikitamohod7971
@nikitamohod7971 3 жыл бұрын
Hello mam You explain the concept of MRCNN so good, It's my request to you plz give the demo of same mask rcnn on any video file.
@CodeWithAarohi
@CodeWithAarohi 3 жыл бұрын
Will upload soon
@nasimthander1296
@nasimthander1296 3 жыл бұрын
Here you are using .h5 for model file, will the code be same for the .pkl model file? If not please help me to counter this problem.
@arnavthakur5409
@arnavthakur5409 10 ай бұрын
Best KZbin channel / Platform to learn Artificial Intelligence , Data Science , Data Analysis , Machine Learning. #BestChannel #KZbinChannel #ArtificialIntelligence #CodeWithAarohi #DataScience #Engineering #MachineLearning #DataAnalysis #BestLearning #LearnDataScience #DataScienceCourse #AytificialIntelligenceCourse #Codewithaarohi #CodeWithAarohi Code with Aarohi
@eliot2884
@eliot2884 7 ай бұрын
Thanks for the share, but I have a remark On this lines : "assert subset in ["train", "val"] dataset_dir = os.path.join(dataset_dir, subset) annotations1 = json.load(open('D:\\env_with_tensorflow1.14\\all_maskrcnn\\maskrcnn_truck_car\\Dataset\\train\\train_json.json'))" The dataset dir end with '\train' or '\val' but on your 'annotations1' there is only the path to 'train' subset. The problem is that when the subset will be 'val' the image_path = os.path.join(dataset_dir, a['filename']) on line 95 will be incorrect because a['filename'] access to the file names of the train json image and not the val image. So if the filename is image_train.jpg the path would be ''...\\Dataset\\val\\image_train.jpg" but on the val_json there is not train image but only "v1","v2" so there will be an error. So its necessary to change the path of the annotations1 according to the subset.
@sanjayankali7006
@sanjayankali7006 7 ай бұрын
one doubt madam, while training the maskrcnn, we have to have same images in train and val folder or different?
@CodeWithAarohi
@CodeWithAarohi 7 ай бұрын
different images for training and validation
@Aditya-hb8eo
@Aditya-hb8eo 3 ай бұрын
i am having python 3.8.0 but many errors are coming due to different version compatiblity , can you give what all versions are required for each library
@CodeWithAarohi
@CodeWithAarohi 3 ай бұрын
Follow this video: kzbin.info/www/bejne/h4Gcf59jo9xrb5I and This code is tested on python 3.8.0, tensorflow 2.4.0 and keras 2.3.1
@developerr4001
@developerr4001 3 жыл бұрын
Hi Aarohi maam, I have two classes for which I followed your tutorials on RCNN. I am getting an error: raise FileNotFoundError("No such file: '%s'" % fn) FileNotFoundError: No such file: '/Users/r/Desktop/mrcnn/dataset/val/checkbox_on_1.jpg' In my dataset, I have 66 training data (for 2 classes) and 09 validation data. At the time of execution, the program gives the error. The file, program is looking for, is in the training folder. But it searches for that particular file in the validation folder as well. "checkbox_on_1.jpg' file is only in the train folder, not sure why it is also asking for the same file in tge val folder? How can I solve this?
@shabirahmed6510
@shabirahmed6510 3 жыл бұрын
Hello I had the same problem , just change your subset = "train" and comment these lines # Train or validation dataset? #assert subset in ["train", "val"] dataset_dir = os.path.join(dataset_dir, "train")
@shabirahmed6510
@shabirahmed6510 3 жыл бұрын
this happens because the model is taking val folder always so we just set the subset to train
@ritusingh6855
@ritusingh6855 3 жыл бұрын
@@shabirahmed6510 how do we resolve this?? I am getting the same error, the images from the train folder is getting checked in the val folder.
@ritusingh6855
@ritusingh6855 3 жыл бұрын
Try this annotations1 = json.load(open(os.path.join(dataset_dir, 'wee_paddy.json'))) keep the name of the json files in the both train and val folders
@rafif6617
@rafif6617 2 жыл бұрын
i had the same issue, anyone solve this? its like annotations for train applied to the val??
@ainulhakimbinfizalsabillah4011
@ainulhakimbinfizalsabillah4011 2 жыл бұрын
Hi, Madam. That is very informative knowledge to learn step by step using mask rcnn. I wonder, how can i continue or extend the learning epoch. I have following your step but making some adjustment with my own dataset and about 50 epochs. but my result is not fulfill, so i want to extend the training but does not want to start over because my training will take about 6-7 hours. so can you guide me? thanks.
@saadsalmanresearchassociat674
@saadsalmanresearchassociat674 2 жыл бұрын
First of all, thanks for an amazing tutorial. Secondly, when I run the file, I get this error: FileNotFoundError: No such file: 'C:\Users\Saad Salman\Desktop\Mask-RCNN\Dataset\val\angry.8affb600-fe31-11ec-bcdd-b46bfc8af0c1.jpg'. However, this file is in the training folder. I dont know why is it searching for it in the val folder
@AnumFatima427
@AnumFatima427 2 жыл бұрын
I'm facing the same issue
@saadsalmanresearchassociat674
@saadsalmanresearchassociat674 2 жыл бұрын
@@AnumFatima427 I pasted a comment referring to a blog that uses Mask RCNN, which was deleted, I don't know why. Using the code from that I solved this issue in my implementation.
@saadsalmanresearchassociat674
@saadsalmanresearchassociat674 2 жыл бұрын
@@AnumFatima427 I think I cant post links to blogs here.
@AnumFatima427
@AnumFatima427 2 жыл бұрын
I found a solution from comments and it worked for me, 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')))
@DeathlessLife786
@DeathlessLife786 Жыл бұрын
Hi mam, to run custom file i am getting many errors.I have installed python 3.11.0 in my laptop. Which tensorflow and keras are suitable to run code from your github?
@CodeWithAarohi
@CodeWithAarohi Жыл бұрын
Use python 3.6.8 , tensorflow 1.14 and keras 2.2.5
@DeathlessLife786
@DeathlessLife786 Жыл бұрын
@@CodeWithAarohi thank you mam...Will try my level best...
@biplabdas8635
@biplabdas8635 2 жыл бұрын
Ma'am my training has run successfully but during testing when we take random image the box is not appearing and it is appearing in the whole image so ma'am can you suggest me what I need to do now
@CodeWithAarohi
@CodeWithAarohi 2 жыл бұрын
I need more details like how many classes you are working upon? How many images per class you have etc. Mail me all your project details at aarohisisngla1987@gmail.com
@namalnshashi923
@namalnshashi923 3 жыл бұрын
Hi, You have given the path to json file of annotation info of training data but json file for validation data is not given. I faced this error and passed separate json files for train and validation data. Now it starts to train Epoch 1 but I cannot see CPU or GPU consumption. Please help.
@amnasiddiqui1017
@amnasiddiqui1017 2 жыл бұрын
how to pass separate json file for validation data?
@deeplearningwithfawadsalam4762
@deeplearningwithfawadsalam4762 2 жыл бұрын
Hi mam, I want to know how can we compute the feature map of mask rcnn? Any code or help you can give.thanks
@datasciencewitharbaaz5221
@datasciencewitharbaaz5221 2 жыл бұрын
Which tensorflow and keras version are you using for this particular project, because I am getting problems with versions of tf and keras.
@CodeWithAarohi
@CodeWithAarohi 2 жыл бұрын
tensorflow 1.15, keras 2.2.5, h5py 2.10.0
@datasciencewitharbaaz5221
@datasciencewitharbaaz5221 2 жыл бұрын
@@CodeWithAarohi Thank you mam. and can you please tell us the python version as well.
@waleedabu-khader5367
@waleedabu-khader5367 2 жыл бұрын
Thanks great work How did you create a separate environment? And my PC doesn’t have a dedicated GPU how can i run the training this way? How did you launch the test model file on jupyter notebook? I downloaded the file but I can’t open it! Kindly help!
@CodeWithAarohi
@CodeWithAarohi 2 жыл бұрын
You can set GPU_COUNT in config.py file which is in mrcnn folder . And use tensorflow instead of tensorflow-gpu
@malusisibiya3330
@malusisibiya3330 2 жыл бұрын
Does this work with tensorflow 2.x. I noticed that in your directory the active version of tensorflow is 1.14?
@CodeWithAarohi
@CodeWithAarohi 2 жыл бұрын
This code work with tensorflow 1.14
@richasharma5949
@richasharma5949 3 жыл бұрын
I am getting the following error: File "custom.py", line 77, in load_custom annotations = [a for a in annotations if a['regions']] File "custom.py", line 77, in annotations = [a for a in annotations if a['regions']] TypeError: list indices must be integers or slices, not str
@THEULTIMATEPRASHANT
@THEULTIMATEPRASHANT 2 жыл бұрын
same error, u got any solution?
@eyeris5812
@eyeris5812 2 жыл бұрын
@@THEULTIMATEPRASHANT have you found a solution yet?
@THEULTIMATEPRASHANT
@THEULTIMATEPRASHANT 2 жыл бұрын
@@eyeris5812 yes you need to change it to str.. where it accepts as int… it’s mid night in my region and Saturday too.. i will reply in detail on monday
@eyeris5812
@eyeris5812 2 жыл бұрын
@@THEULTIMATEPRASHANT Bhai, we might be from the same region, thank you though!
@chanchan6312
@chanchan6312 2 жыл бұрын
@@THEULTIMATEPRASHANT how to correct this? Plz help if you know how, thank you so much
@Sandhya_Bytes
@Sandhya_Bytes 10 ай бұрын
Mam is there a necessary to do any preprocessing for images if yes in which file I have to do them please reply for this mam
@CodeWithAarohi
@CodeWithAarohi 10 ай бұрын
Proprocessing is important.
@nailashah6918
@nailashah6918 3 жыл бұрын
Hi Arohi ji I want to ask one thing: If we are annotating images using vgg annotator.It seems applicable for train set images but why to annotate validation set using vgg annotator?It should be now a task of mask rcnn to identify objects and apply mask
@CodeWithAarohi
@CodeWithAarohi 3 жыл бұрын
Hello...Training set is used to train the model. We annotate val data because Validation data is used for regularization. It also helps in avoiding the problem of overfitting. It basically estimates the prediction error. Test data is used to evaluate model.
@prudhvinarayana5331
@prudhvinarayana5331 Жыл бұрын
Hi Aarohi,i am unable to download the class-descriptions-boxable.csv file, train-annotations-bbox.csv file from the command Can u please help me to fix it?
@CodeWithAarohi
@CodeWithAarohi Жыл бұрын
What is the issue you are facing?
@madanparajuli9080
@madanparajuli9080 3 жыл бұрын
Hi Ma'am, can you provide us the version of tensorflow, keras and python you used for successfully running this code? I did the exact same thing as you mentioned in this video but I am having a error called "ValueError: Tried to covert 'shape' to a tensor and failed. Error: None values not supported."
@CodeWithAarohi
@CodeWithAarohi 3 жыл бұрын
I am not sure why are you getting this error. I have to see the code
@bolzanoitaly8360
@bolzanoitaly8360 2 жыл бұрын
pip install tensorflow == 1.14.0
@deepalisharma1327
@deepalisharma1327 3 жыл бұрын
Mam, I am running the code on MacOS and now getting any file generated under logs folder. Instead, I am getting warning as : I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA. Could you please suggest?
@CodeWithAarohi
@CodeWithAarohi 3 жыл бұрын
you can ignore the warning. Warning will stop your code processing
@deepalisharma1327
@deepalisharma1327 3 жыл бұрын
@@CodeWithAarohi I was able to solve the issue. I am not getting any errors but model files are also not getting created under logs folder.
@harinderkaur8320
@harinderkaur8320 3 жыл бұрын
It is showing warning: you are using default load mask(),may be you need to define your own one...repeatedly..plz help
@rigvedsanku5128
@rigvedsanku5128 3 жыл бұрын
Arohi ji, thank yiu for the explaination... How do we proceed if we already have the masked images as our target ?
@CodeWithAarohi
@CodeWithAarohi 3 жыл бұрын
Then start by running custom.py file
@Sandhya_Bytes
@Sandhya_Bytes 10 ай бұрын
Mam I have a doubt actually i am doing a project on landslide detection using mask rcnn ...in this particular video the changes u have done for the custom.py file for the above project are the same changes i have to do for my project also or there are some other to make changes.Please reply mam it would be helpful for me 😊🙏😊🙏
@CodeWithAarohi
@CodeWithAarohi 10 ай бұрын
Same changes
@Sandhya_Bytes
@Sandhya_Bytes 10 ай бұрын
@@CodeWithAarohi Thank you soo much mam u are a good teacher and.. this video is very helpful for my academic project
@Sandhya_Bytes
@Sandhya_Bytes 10 ай бұрын
@@CodeWithAarohi Mam in which file i have to perform preprocessing techniques mam Please reply mam??
@CodeWithAarohi
@CodeWithAarohi 10 ай бұрын
Glad it is helpful@@Sandhya_Bytes
@BHAUKALEXPERIMENT
@BHAUKALEXPERIMENT Жыл бұрын
when i run this then keras.engine not found erorrs acurs my tensorflow is 2. version and python is 3.11
@CodeWithAarohi
@CodeWithAarohi Жыл бұрын
Use oython 3.6.8 and tensorflow 1.14
@fahadulislam863
@fahadulislam863 2 жыл бұрын
Can you please mention the versions u use?
@abdullahalnakib5150
@abdullahalnakib5150 3 жыл бұрын
Your videos are awesome. Ma'am, I will be really grateful if you make a video about how to set up the environment to run this MaskRCNN with a GPU of nvidia 30 series, Thank you.
@CodeWithAarohi
@CodeWithAarohi 3 жыл бұрын
Process is similar as we do for other GPU's
@thu-anhtran9787
@thu-anhtran9787 2 жыл бұрын
Hello, Sorry if this is simple, but I am getting an indexing error "IndexError: index 50 is out of bounds for axis 1 with size 50" on the line mask[rr, cc, i] = 1 in load_mask. Do you have any suggestions on how to fix this? Thank you
@prashanthabib452
@prashanthabib452 2 жыл бұрын
Hello, i am also getting this error ... Have you figured out this ?
@filipt8945
@filipt8945 3 жыл бұрын
Hello Aarohi, in other implementations to calculate the mAP I have seen that before applying the model.detect function on the image they apply the functions of mold_image from modellib and expand_dims from numpy, to convert the pixel values and to convert the image into only one sample. Using your method I get a higher value of mAP than with the other implementations. Are those steps that I am telling you necessary?
@CodeWithAarohi
@CodeWithAarohi 3 жыл бұрын
I am not sure about the other methods which you are talking about as I worked with this method only. And I think the approach we are using to get the mAP is correct
@darkdk20
@darkdk20 2 жыл бұрын
My Epoch has be running from 1/20 for pass 5-6 hrs and it could not run till 20/20, i not sure whats the problem
@sean9734
@sean9734 2 жыл бұрын
same, did you solve this?
@rzoo1531
@rzoo1531 2 жыл бұрын
I'm using anaconda to run the program, and I have library and module compatibility issue, is there any reference on what libraries this mask-rcnn run on?
@CodeWithAarohi
@CodeWithAarohi 2 жыл бұрын
What is the issue you are facing?
@rzoo1531
@rzoo1531 2 жыл бұрын
@@CodeWithAarohi Hi thank you for replying, I still haven't solved it. The compatibility problem occurred usually when my TensorFlow, scikit, OpenCV, etc don't match the version that the code is importing and it keep crashing every time I tried to lower the version. So maybe you can share your environment set up like what version of python, TensorFlow, scikit or anything that needed to be installed on your virtual environment
@rzoo1531
@rzoo1531 2 жыл бұрын
@@CodeWithAarohi Also I do notice that there is requirement.txt but there is still some incompatibility with the present update and some are not detailed with what version should be used
@devavratpro7061
@devavratpro7061 2 жыл бұрын
Ma'am, tensorflow 1.x has been unsupported by Colab. Will it run on tensorflow 2???
@CodeWithAarohi
@CodeWithAarohi 2 жыл бұрын
This code is compatible with tensorflow 1.x. You can downgrade the pip version of colab and then you can install the tensorflow 1.x
@devavratpro7061
@devavratpro7061 2 жыл бұрын
@@CodeWithAarohi I tried but it is suggesting to update the code on tensorflow 2. Can you please upgrde your code? Thanks in advance.
@salmabo3809
@salmabo3809 3 жыл бұрын
Hi Aarohi, please can you tell me what the tensorflow and keras version you used?
@CodeWithAarohi
@CodeWithAarohi 3 жыл бұрын
Use tensorflow 1.14 and keras 2.2.4
@salmabo3809
@salmabo3809 3 жыл бұрын
@@CodeWithAarohi thank you
@adityask865
@adityask865 2 жыл бұрын
Hello ma,am Amazing tutorial for maskrcnn when i run custom.py i get the following error File "custom.py", line 17, in from mrcnn import model as modellib File "D:\Zipfiles\Editha_tensorflow\mrcnn\model.py", line 255, in class ProposalLayer(KE.Layer): AttributeError: module 'keras.engine' has no attribute 'Layer' can you please tell me the problem?
@CodeWithAarohi
@CodeWithAarohi 2 жыл бұрын
Tell me the keras version you are using.
@adityask865
@adityask865 2 жыл бұрын
@@CodeWithAarohi 2.11.0
@fobaogunkeye3551
@fobaogunkeye3551 2 жыл бұрын
Thanks for the video tutorial! However, you didn't put the link to the pre-trained weights. How can I get it?
@CodeWithAarohi
@CodeWithAarohi 2 жыл бұрын
github.com/matterport/Mask_RCNN/releases/download/v2.0/mask_rcnn_coco.h5
@fobaogunkeye3551
@fobaogunkeye3551 2 жыл бұрын
@@CodeWithAarohi Thank you. I've been getting an error coming from the load_mask function. Please how do I solve this? IndexError: index 1280 is out of bounds for axis 1 with size 1280
@Lucas-nw7lj
@Lucas-nw7lj 3 жыл бұрын
Thank you for your explanation. I'm executing the test_truck_car_model.ipynb with own datasets. When I want to perform the prediction, which predict images which are not present in dataset, the result showed "No instances to display". Do you have any idea about this error?
@CodeWithAarohi
@CodeWithAarohi 3 жыл бұрын
"No instances to display" means objects are not detected. You need to improve your model. Try to increase dataset , epochs
@Lucas-nw7lj
@Lucas-nw7lj 3 жыл бұрын
@@CodeWithAarohi thanks so much for replying
@puranjitsingh1782
@puranjitsingh1782 3 жыл бұрын
I am using Labelme annotation tool to annotate the images to prepare a .json file. I am having a problem in the loop (for a in annotations), can you guide what could be done??
@puranjitsingh1782
@puranjitsingh1782 3 жыл бұрын
It is storing the content in .json file in a different way than how VGG annotator saves a .json file
@CodeWithAarohi
@CodeWithAarohi 3 жыл бұрын
annotation should be in coco format using polygon shape
@bhatiapkaur
@bhatiapkaur 2 жыл бұрын
@@puranjitsingh1782 i have used plain sight annotation tool for large dataset, but facing same problem with .json format, any suggestions?
@puranjitsingh1782
@puranjitsingh1782 2 жыл бұрын
@@bhatiapkaur No idea, I was using labelme annotation toll earlier for data labelling, but now have shifted to CVAT Annotation tool and its the best annotation tool I have used so far. I was preparing a model based on using Mask-RCNN earlier but now am working on developing a model using U-Net architecture
@Neon-lens
@Neon-lens 3 жыл бұрын
AttributeError: module 'utils' has no attribute 'gt_pred_lists' when trying to calculate mAP I get the above error. In the file utils.py the function "gt_pred_lists" is missing. Do you have the code for this function?
@CodeWithAarohi
@CodeWithAarohi 3 жыл бұрын
Take utils file from this location and copy that missing function in your utils.py file : github.com/AarohiSingla/Mask-RCNN-on-Custom-Dataset-2classes-
@esotericwanderer6473
@esotericwanderer6473 3 жыл бұрын
Great job ma'am!! can u plz do project on face mask detection?
@CodeWithAarohi
@CodeWithAarohi 3 жыл бұрын
Yes, sure
@beingSupraa
@beingSupraa Жыл бұрын
when i run the training part it says TypeError: Could not build a TypeSpec for KerasTensor(type_spec=TensorSpec(shape=(None, None, 4), dtype=tf.float32, name=None), name='tf.math.truediv_13/truediv:0', description="created by layer 'tf.math.truediv_13'") of unsupported type how to fix this please ?
@onewhoflutters4866
@onewhoflutters4866 7 ай бұрын
Hello , I have same error, This problem is related to tensorflow version.
@waleedak6164
@waleedak6164 2 жыл бұрын
I don't have a GPU on my PC, can you share a video that runs on google Colab?
@aminmemar416
@aminmemar416 Жыл бұрын
Does mask rcnn supports binary mask as training in json file?
@CodeWithAarohi
@CodeWithAarohi Жыл бұрын
No
@aminmemar416
@aminmemar416 Жыл бұрын
@@CodeWithAarohi how about RLE json annotation format?
@aakritisharma6222
@aakritisharma6222 2 жыл бұрын
HI Aarohi, I love learning from your videos they are very informative. I am applying Mask-RCNN. on custom dataset but I want to use Resnet50 what changes do I need to perform
@CodeWithAarohi
@CodeWithAarohi 2 жыл бұрын
Mask RCNN is a Segmentation model and ResNet is a Image classification model. You can't use ResNet at the place of MaskRCNN.
@aakritisharma6222
@aakritisharma6222 2 жыл бұрын
@@CodeWithAarohi hello, I want to use resnet50 instead of resnet101 as the backbone. What changes needs to be done for that. I would be really obliged if you could explain this backbone change part as well
@aakritisharma6222
@aakritisharma6222 2 жыл бұрын
@@CodeWithAarohi I tried changing the backbone from resnet101 to resnet50 and working on maskRCNN as segmentation model, but no luck. Any suggestions for how to implement?
@PremKumar-zb8gt
@PremKumar-zb8gt Жыл бұрын
if you get long data set how to validation
@puranjitsingh1782
@puranjitsingh1782 3 жыл бұрын
Can we use latest version of tensorflow for this MaskRCNN execution
@CodeWithAarohi
@CodeWithAarohi 3 жыл бұрын
This code will work with older version but if you want to use it with tensorflow 2 then you need to make changes in the code
@sanjayankali7006
@sanjayankali7006 7 ай бұрын
Hello madam, please confirm whether the data in train and validation while creating annotation using VGG annotation should be same or different because i am getting very low detection precision here is the output for detecting KNEE MRI BONE Processing 1 images image shape: (1024, 1024, 3) min: 0.00000 max: 64280.00000 int32 molded_images shape: (1, 1024, 1024, 3) min: -123.70000 max: 64176.10000 float64 image_metas shape: (1, 16) min: 0.00000 max: 1024.00000 int64 anchors shape: (1, 261888, 4) min: -0.35390 max: 1.29134 float32 the actual length of the ground truth vect is : 3 the actual length of the predicted vect is : 3 Average precision of this image : 0.0 The actual mean average precision for the whole images 0.0
@CodeWithAarohi
@CodeWithAarohi 7 ай бұрын
The images used for training is different than the images used for validation
@onewhoflutters4866
@onewhoflutters4866 7 ай бұрын
Hi, How can I change the python version to 3.8.0 in google colab?
@CodeWithAarohi
@CodeWithAarohi 7 ай бұрын
Try these commands: !sudo apt-get update -y !sudo apt-get install python3.8 !sudo apt-get install python3.8-dev !sudo apt-get install python3.8-venv
@addisbelayneh1585
@addisbelayneh1585 3 жыл бұрын
Hi Aarohi, I have a question to ask:how to lebeling ,detect and classify multiclass in one image using MaskRCNN ?hint,one image has multiclass and also one class has the more than one object so how to leveling them using VIA or how to perpare json file ?
@CodeWithAarohi
@CodeWithAarohi 3 жыл бұрын
The Process is same. Just create mask for every object present in that image and Assign class name to every object.
@addisbelayneh1585
@addisbelayneh1585 3 жыл бұрын
@@CodeWithAarohi ok thanks madam,but ,how to lebeling more than one object in one class?for example object1,object2 ,object3,....... etc all are lebeling in one class and also class2,class3,.....etc
@gayathrit.v8844
@gayathrit.v8844 9 ай бұрын
what are version used for tensorflow and keras
@CodeWithAarohi
@CodeWithAarohi 9 ай бұрын
This code is tested on Python 3.8.0, tensorflow 2.4.0, keras 2.3.1 and h5py 2.10.0
Plant leaf disease detection using Mask R-CNN | Image Segmentation
17:49
Code With Aarohi
Рет қаралды 38 М.
283 - What is Mask R-CNN?
23:46
DigitalSreeni
Рет қаралды 38 М.
БОЙКАЛАР| bayGUYS | 27 шығарылым
28:49
bayGUYS
Рет қаралды 1,1 МЛН
Instance Segmentation Using Mask R-CNN on Custom Dataset
30:35
Code With Aarohi
Рет қаралды 29 М.
284 - Installing Mask RCNN and troubleshooting errors
21:44
DigitalSreeni
Рет қаралды 36 М.
Mask R-CNN | Practical Implementation
16:38
Code With Aarohi
Рет қаралды 9 М.
Best of CES 2025
14:50
The Verge
Рет қаралды 318 М.
GANs Implementation: Creating Faces that Don't Exist
55:11
Code With Aarohi
Рет қаралды 435
SAM 2 | Segment Anything Model 2
32:13
Code With Aarohi
Рет қаралды 6 М.
How to apply MaskRCNN for Medical Images: Explanations and Code
20:20
AI with Sohini
Рет қаралды 10 М.
Mask Region based Convolution Neural Networks - EXPLAINED!
9:35
CodeEmporium
Рет қаралды 156 М.