Hi, I’ve tried to train custom object detection model via tflite-model-makers referred to @khanhlvg 's Train a custom object detection model using your data
Unfortunately, I met the following error, and I don’t know how to solve it. Is there anyone who can give me the Christmas present?
InvalidArgumentError: 2 root error(s) found.
(0) INVALID_ARGUMENT: assertion failed: [ERROR: please increase config.max_instances_per_image] [Condition x < y did not hold element-wise:] [x (parser/strided_slice_17:0) = ] [129] [y (parser/assert_less/y:0) = ] [100]
[[{{node parser/assert_less/Assert/Assert}}]]
[[MultiDeviceIteratorGetNextFromShard]]
[[RemoteCall]]
[[IteratorGetNext]]
[[batch_cls_loss/write_summary/summary_cond/then/_4138/batch_cls_loss/write_summary/ReadVariableOp/_94]]
(1) INVALID_ARGUMENT: assertion failed: [ERROR: please increase config.max_instances_per_image] [Condition x < y did not hold element-wise:] [x (parser/strided_slice_17:0) = ] [129] [y (parser/assert_less/y:0) = ] [100]
[[{{node parser/assert_less/Assert/Assert}}]]
[[MultiDeviceIteratorGetNextFromShard]]
[[RemoteCall]]
[[IteratorGetNext]]
I googled and found this issue but I have no I idea how i use it on TF lite model maker env.
opened 03:51AM - 13 Mar 20 UTC
closed 04:29AM - 13 Mar 20 UTC
Hi,
I'm using maskrcnn in Detectron2 to count the number of bacteria in an i… mage using a custom dataset, and the tutorial jupyter notebook and I've noticed that for every image I use I get a maximum of 100 instances. Is this a strange coincidence, or does detectron2/mask max out at 100 instances per image?
Cheers,
Ed
dylan
December 27, 2021, 5:54am
4
You need to pass the max instance number as an hparam when the model is created. Set the MAXOBJECTCOUNT slightly higher than the max number of objects you expect to see in an image.
from tflite_model_maker import object_detector
object_detector.EfficientDetLite0Spec(hparams {'max_instances_per_image': MAXOBJECTCOUNT})
All kinds of model parameters can be tweaked using the hyper params dictionary.
You can read more about them here .
Thnanks @dylan
Unfortunately, I set the MAXOBJECTCOUNT to 8000 but it occurred same error.
It resolved! I modified the code to this
# instead of spec = model_spec.get('efficientdet_lite0')
spec = object_detector.EfficientDetSpec(
model_name='efficientdet-lite0',
uri='https://tfhub.dev/tensorflow/efficientdet/lite0/feature-vector/1',
hparams={'max_instances_per_image': 8000})
That pass the hyperparameters directly and this worked successfully
1 Like
yyoon
December 30, 2021, 3:50am
10
Glad it actually worked out for you!
1 Like
Skynet
September 5, 2022, 9:43am
12
This worked for me. I have a model with 1 class with multiple (hundreds) of occourrences on a picture
Worked for me as well, thanks