You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
readNetFromTensorflow crash, in "else if (type == "FusedBatchNorm") { //break here }" #14236
Try to turn Keras's training phase to false because this model serialized in the training mode.
Thanks very much , after turning Keras's training phase to false by the following code , it will not crash in is_training code anymore
for i in range(len(init_graph.node)):
node = init_graph.node[i]
if node.op == 'FusedBatchNorm':
if 'is_training' in node.attr:
if node.attr['is_training'].b == True :
print ('before:',node.attr)
node.attr['is_training'].b = False
print ('after' , node.attr)
but it crashed in following code :
//tf_importer.cpp crashed in line 1521
else if (type == "FusedBatchNorm")
{
... ...
if (isTraining)
{
... ...
}else{
...
//crashed in getConstBlob in "case tensorflow::DT_HALF: parseTensor( ... )"
blobFromTensor(getConstBlob(layer, value_id, 4), std);
}
Thanks @dkurt , I have tried to set_learning_phase(0), but it seems it doesn't hep . It displays is_training phase is True in tensorboard as well .
my code :
@dkurt Thanks . After I tried the python script you gave me above and modified the code of opencv4.0.1 , it crashed as well . It crashed in bellow code when type shows as 'Switch' .
in tf_importer.cpp in line 1905: it crashed here when parsing layer "batch_normalization_94/cond/FusedBatchNorm/Switch_3"
for (int i = 0; i < layer.input_size(); ++i)
{
if (value_id.find(layer.input(i)) != value_id.end())
{
//it crashed here line 1905
Mat blob = getTensorContent(getConstBlob(layer, value_id, i));
layerParams.blobs.push_back(blob);
}
else
inputsNames.push_back(layer.input(i));
}
crashed in tf_graph_simplifier.cpp in line 773 when Tensor's data type shows as DT_BOOL
//crashed here in tf_graph_simplifier.cpp in line 773
CV_Error(Error::StsError, "Tensor's data type is not supported");
Activity
dkurt commentedon Apr 3, 2019
Try to turn Keras's training phase to false because this model serialized in the training mode.
ib198669 commentedon Apr 4, 2019
Thanks very much , after turning Keras's training phase to false by the following code , it will not crash in is_training code anymore
but it crashed in following code :
I really don't know why it crashed here ~
dkurt commentedon Apr 4, 2019
@ib198669, Take a look at https://keras.io/backend/#set_learning_phase
ib198669 commentedon Apr 8, 2019
Thanks @dkurt , I have tried to set_learning_phase(0), but it seems it doesn't hep . It displays is_training phase is True in tensorboard as well .
my code :
dkurt commentedon Apr 9, 2019
@ib198669, Thank you. We've also found a bug analyzing this model so you need to apply these changes to the code: #14284.
To enable this model in OpenCV please do the following:
Then import
graph.pbwith OpenCV.ib198669 commentedon Apr 10, 2019
@dkurt Thanks . After I tried the python script you gave me above and modified the code of opencv4.0.1 , it crashed as well . It crashed in bellow code when type shows as 'Switch' .
in tf_importer.cpp in line 1905: it crashed here when parsing layer "batch_normalization_94/cond/FusedBatchNorm/Switch_3"
crashed in tf_graph_simplifier.cpp in line 773 when Tensor's data type shows as DT_BOOL
dkurt commentedon Apr 10, 2019
@ib198669, make sure you use the latest state of OpenCV (especially the changes from #14251).
ib198669 commentedon Apr 11, 2019
@dkurt thanks a lot . After update the newest code of opencv(4.10) and modify the dnn code as #14284 , the bug is gone .