<h5 dir="auto">System information (version)</h5>

<ul dir="auto">
<li>OpenCV =&gt; 4.2.0.32</li>
<li>Operating System / Platform =&gt; Windows 10 64 Bit</li>
<li>Compiler =&gt; Visual Studio 2017</li>
</ul>
<h5 dir="auto">Detailed description</h5>
<p dir="auto">I am getting the following error when performing inference with SSD MobileNet v2 custom trained model using OpenCV cv.dnn_Net.forward():</p>
<p dir="auto">cv2.error: OpenCV(4.2.0) C:\projects\opencv-python\opencv\modules\dnn\src\dnn.cpp:562: error: (-2:Unspecified error) Can't create layer "FeatureExtractor/MobilenetV2/expanded_conv_2/add" of type "AddV2" in function 'cv::dnn::dnn4_v20191202::LayerData::getLayerInstance'</p>
<p dir="auto">I trained the model using TensorFlow 1.15.0 and can perform inference in TensorFlow and TensorFlow Lite without an issue; is only when I use dnn-module with .pb and .pbtxt files that I get the error above. I have tried downgrading OpenCV, but earlier versions give different errors. In Ubuntu 18.04.4, installing OpenCV from source, I do not get any errors.</p>
<h5 dir="auto">Steps to reproduce</h5>
<p dir="auto">OpenCV TensorFlow Object Detection API:<br>
python tf_text_graph_ssd.py --input frozen_graph.pb --config ssd_mobilenet_v2_coco.config --output graph.pbtxt</p>
<p dir="auto">Inference using Python script from OpenCV wiki:<br>
import cv2 as cv<br>
cvNet = cv.dnn.readNetFromTensorflow('frozen_graph.pb', 'graph.pbtxt')</p>
<p dir="auto">img = cv.imread('example.jpg')<br>
rows = img.shape[0]<br>
cols = img.shape[1]<br>
cvNet.setInput(cv.dnn.blobFromImage(img, size=(300, 300), swapRB=True, crop=False))<br>
cvOut = cvNet.forward()</p>
<p dir="auto">for detection in cvOut[0,0,:,:]:<br>
score = float(detection[2])<br>
if score &gt; 0.3:<br>
left = detection[3] * cols<br>
top = detection[4] * rows<br>
right = detection[5] * cols<br>
bottom = detection[6] * rows<br>
cv.rectangle(img, (int(left), int(top)), (int(right), int(bottom)), (23, 230, 210), thickness=2)</p>
<p dir="auto">cv.imshow('img', img)<br>
cv.waitKey()</p>
<h5 dir="auto">Issue submission checklist</h5>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I report the issue, it's not a question

</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I checked the problem with documentation, FAQ, open issues,<br>
answers.opencv.org, Stack Overflow, etc and have not found solution

</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I updated to latest OpenCV version and the issue is still there

</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> There is reproducer code and related data files: videos, images, onnx, etc<br>
<a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/32305778/77545175-0a876e00-6e78-11ea-8bb2-af4071908503.png"><img src="https://user-images.githubusercontent.com/32305778/77545175-0a876e00-6e78-11ea-8bb2-af4071908503.png" alt="example" style="max-width: 100%;"></a>

</li>
</ul>
<p dir="auto"><strong>System information (version)</strong><br>
OpenCV =&gt; 4.2.0<br>
Operating System / Platform =&gt; Windows 10 64 bit<br>
Compiler =&gt; Visual Studio 2019<br>
TensorFlow 2.1.0</p>
<p dir="auto"><strong>Detailed description</strong><br>
I have trained a MobileNetV2 using tf.keras. Then I exported the model as frozen graph *.pb file, and tried to load the network using cv::dnn::readNetFromTensorflow(). When I run the app the following error occurs:<br>
<code class="notranslate">OpenCV(4.2.0) Error: Unspecified error (Can't create layer "expanded_conv_add/add" of type "AddV2") in cv::dnn::dnn4_v20191202::LayerData::getLayerInstance, file C:\build\master_winpack-build-win64-vc14\opencv\modules\dnn\src\dnn.cpp, line 562 </code></p>
<p dir="auto">When using TensorFlow version 1.14 for creating the model and then save the frozen graph, this kind of error does not appear</p>
<p dir="auto"><strong>Steps to reproduce</strong><br>
The .pb file is found inside the attached .zip file</p>
<p dir="auto"><code class="notranslate">_net = cv::dnn::readNetFromTensorflow(pathToPbFile);</code></p>
<p dir="auto"><a href="https://github.com/opencv/opencv/files/4091426/MobileNetV2Alpha0.10.zip">MobileNetV2Alpha0.10.zip</a></p>