从tensorflow加载cv.dnn.readnet中的张量流模型时出现错误

我遇到这样的错误 cv2.error:OpenCV(4.1.1)/io/opencv/modules/dnn/src/tensorflow/tf_importer.cpp:577:错误:(-2:未指定错误)在函数'getconstBlob

我尝试了tf_text_graph.py生成的图形,并将.pb文件和.pbtxt文件都加载到cv.dnn.readfromtensorflow方法中,但它给出了以上错误

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:orientation="vertical"
    android:padding="@dimen/_5sdp"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/relativeLayout">

    <TextView
        android:id="@+id/title_display"
        android:text="@string/course_view"
        android:textSize="@dimen/header_text_size"
        android:layout_toLeftOf="@id/edit_course_button"
        android:layout_toStartOf="@id/edit_course_button"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" />

    <TextView
        android:id="@+id/date_display"
        android:text="@string/start_and_end_dates"
        android:layout_toLeftOf="@id/edit_course_button"
        android:layout_toStartOf="@id/edit_course_button"
        android:layout_below="@id/title_display"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" />

    <TextView
        android:id="@+id/mentor_display"
        android:text="@string/course_mentor_display_default"
        android:layout_toLeftOf="@id/edit_course_button"
        android:layout_toStartOf="@id/edit_course_button"
        android:layout_below="@id/date_display"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" />

    <TextView
        android:id="@+id/credits_display"
        android:text="@string/course_credits_display_default"
        android:layout_toLeftOf="@id/edit_course_button"
        android:layout_toStartOf="@id/edit_course_button"
        android:layout_below="@id/mentor_display"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" />

    <TextView
        android:id="@+id/passed_display"
        android:text="@string/passed"
        android:textColor="#128039"
        android:textStyle="bold"
        android:textSize="@dimen/sub_header_text_size"
        android:visibility="gone"
        android:layout_alignParentRight="true"
        android:layout_alignParentEnd="true"
        android:layout_above="@id/separator"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />

    <Button
        android:id="@+id/edit_course_button"
        android:text="@string/edit_course"
        android:onClick="editCourse"
        android:background="@color/blue_button_bg"
        android:textColor="@color/blue_button_fg"
        android:padding="@dimen/button_padding"
        android:layout_alignParentRight="true"
        android:layout_alignParentEnd="true"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />

    <ImageView
        android:id="@+id/separator"
        android:layout_below="@id/credits_display"
        android:background="#333"
        android:layout_marginTop="10dp"
        android:layout_marginBottom="10dp"
        android:layout_width="match_parent"
        android:layout_height="2dp" />

    </RelativeLayout>

    <ScrollView
        android:layout_below="@id/relativeLayout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content">

            <TextView
                android:id="@+id/objective_header"
                android:text="@string/objectives"
                android:textSize="@dimen/sub_header_text_size"
                android:layout_width="match_parent"
                android:layout_height="wrap_content" />

            <ImageView
                android:id="@+id/create_objective_button"
                android:onClick="createNewObjective"
                android:src="@drawable/ic_add"
                android:layout_alignTop="@+id/objective_header"
                android:layout_alignParentRight="true"
                android:layout_alignParentEnd="true"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" />

            <ListView
                android:id="@+id/objective_list"
                android:layout_below="@id/objective_header"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"/>

            <TextView
                android:id="@+id/assessment_header"
                android:text="@string/assessments"
                android:textSize="@dimen/sub_header_text_size"
                android:layout_below="@id/objective_list"
                android:layout_width="match_parent"
                android:layout_height="wrap_content" />

            <ImageView
                android:id="@+id/create_assessment_button"
                android:onClick="createNewAssessments"
                android:src="@drawable/ic_add"
                android:layout_alignTop="@+id/assessment_header"
                android:layout_alignParentRight="true"
                android:layout_alignParentEnd="true"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" />

            <ListView
                android:id="@+id/assessment_list"
                android:layout_below="@id/assessment_header"
                android:layout_width="match_parent"
                android:layout_height="wrap_content" />

            <TextView
                android:id="@+id/note_header"
                android:text="@string/notes"
                android:textSize="@dimen/sub_header_text_size"
                android:layout_below="@id/assessment_list"
                android:layout_width="match_parent"
                android:layout_height="wrap_content" />

            <ImageView
                android:id="@+id/create_note_button"
                android:onClick="createNewNote"
                android:src="@drawable/ic_add"
                android:layout_alignTop="@+id/note_header"
                android:layout_alignParentRight="true"
                android:layout_alignParentEnd="true"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" />

            <ListView
                android:id="@+id/note_list"
                android:layout_below="@id/note_header"
                android:layout_marginBottom="10dp"
                android:scrollbars="none"
                android:layout_width="match_parent"
                android:layout_height="wrap_content" />

        </RelativeLayout>

    </ScrollView>

</RelativeLayout>

</RelativeLayout>
yinshi88316 回答:从tensorflow加载cv.dnn.readnet中的张量流模型时出现错误

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3169125.html

大家都在问