Error on object segmentation script to generate TFrecords file, create_pet_tf_record.py or in the doc
System information
- What is the top-level directory of the model you are using: model/research/object_detection
- **Have I written custom code **: No
- OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Windows 10
- TensorFlow installed from (source or binary): source
- TensorFlow version (use command below): 1.8.0
- Bazel version (if compiling from source): N/A
- CUDA/cuDNN version: N/A
- GPU model and memory: No GPU
- Exact command to reproduce:
Describe the problem
In the tutorial for training a new model on object segmentation, you should provide masks of course and from the doc:
The spatial dimensions of each mask must agree with the image. Each mask has only a single channel, and the pixel values are either 0 (background) or 1 (object mask).
But in the files provided to produce TFRecords for the pet records dataset create_pet_tf_record.py (in dataset_util/), in the function dict_to_tf_example(), when the mask is opened, nonbackground_indices_x and
nonbackground_indices_y are computed as:
nonbackground_indices_x = np.any(mask_np != 2, axis=0)
nonbackground_indices_y = np.any(mask_np != 2, axis=1)
Shouldn't be mask_np == 1 ? As we are checking which pixel of the mask is not nul to compute:
nonzero_x_indices = np.where(nonbackground_indices_x)
nonzero_y_indices = np.where(nonbackground_indices_y)
Actually I was modifying this script to adapt it to my dataset (LFW part label) and I use the face_only= False to compute the bounding box around the face in each image. My bounding box where always all nul. I think that, as this script as a default of face_only= True and when this option is used the script doesn't use nonzero_x_indices and nonzero_y_indices, it was painless.
I perhaps miss something as I really don't understand how this error could have happened, waiting for your appraisal to eventually prepare a PR.
Cheers !
Victor
I'm having a similar problem. I'm getting groundtruth instance masks not provided though i clearly provide them in the code
@aarif96 if you use the file create_pet_tf_record.py, you can use: nonbackground_indices_x = np.any(mask_np == 1, axis=0) nonbackground_indices_y = np.any(mask_np == 1, axis=1)
Not sure thought, but that worked for me
@derekjchow any update on this?
@victorherbemontagne Hello. Have you seen issue like this (https://github.com/tensorflow/models/issues/4689) ?
@FreedoomFighter answered you
@victorherbemontagne Thank you, but may you go to there again, please?
@victorherbemontagne I'll try that thanks.
Hi, i am really not good at this tutorial... but i am trying to display mask following all tutorials and the toy mask rcnn tutorial, but mask not displayed i see in other ticket you say use use_Mask= true in config file, but what config file ? what line ? please i tried the pet dataset and only bounding boxes is displayed, i use faces_only to true...
Hi @aarif96, did you solve your problem with "Groundtruth instance masks not provided"?
@kulsemig you can check my repo I add the script I used. Let me know if it works for you
@victorherbemontagne what mask do you use ? PNG or JSON ?
PNG
@victorherbemontagne have you a PNG example ? because i created it with VGG, right click and save as PNG, but i made an outline not full mask, it does not recover fully the object , it is juste the outline, what application did you use to make it ? it does'nt work with my PNG, the bounded box is recover with green mask... not only object, and my goal is juste have the object outline segmentation
thanks !
Hi There, We are checking to see if you still need help on this, as this seems to be considerably old issue. Please update this issue with the latest information, code snippet to reproduce your issue and error you are seeing. If we don't hear from you in the next 7 days, this issue will be closed automatically. If you don't need help on this issue any more, please consider closing this.