cmdbug / YOLOv5_NCNN

🍅 Deploy ncnn on mobile phones. Support Android and iOS. 移动端ncnn部署,支持Android与iOS。
GNU General Public License v3.0
1.48k stars 298 forks source link

请问替换为自己的yolact模型需要改哪些呢? #78

Closed oddityyyy closed 2 years ago

oddityyyy commented 2 years ago

我自己训练了一个yolact, 并根据nihui的方法转成了ncnn模型,请问大神需要改哪几个文件的哪些参数呢? 谢谢大佬!

cmdbug commented 2 years ago

.cpp 修改/输入输出的名称

oddityyyy commented 2 years ago

.cpp 修改/输入输出的名称

W/ActivityThread: handleWindowVisibility: no activity for token android.os.BinderProxy@b492341 I/Choreographer: Skipped 253 frames! The application may be doing too much work on its main thread. I/OpenGLRenderer: Davey! duration=4228ms; Flags=0, IntendedVsync=173814960330496, Vsync=173819176996994, OldestInputEvent=9223372036854775807, NewestInputEvent=0, HandleInputStart=173819182689419, AnimationStart=173819182800512, PerformTraversalsStart=173819183738533, DrawStart=173819184603117, SyncQueued=173819186355408, SyncStart=173819186407804, IssueDrawCommandsStart=173819186503012, SwapBuffers=173819187739783, FrameCompleted=173819188643429, DequeueBufferDuration=195000, QueueBufferDuration=384000, E/libc: Access denied finding property "vendor.camera.aux.packagelist" W/com.wzt.yolov5: type=1400 audit(0.0:1161548): avc: denied { read } for name="u:object_r:vendor_camera_prop:s0" dev="tmpfs" ino=5969 scontext=u:r:untrusted_app:s0:c40,c257,c512,c768 tcontext=u:object_r:vendor_camera_prop:s0 tclass=file permissive=0 W/com.wzt.yolov5: type=1400 audit(0.0:1161549): avc: denied { read } for name="u:object_r:vendor_camera_prop:s0" dev="tmpfs" ino=5969 scontext=u:r:untrusted_app:s0:c40,c257,c512,c768 tcontext=u:object_r:vendor_camera_prop:s0 tclass=file permissive=0 E/libc: Access denied finding property "vendor.camera.aux.packagelist" E/libc: Access denied finding property "vendor.camera.aux.packagelist" W/com.wzt.yolov5: type=1400 audit(0.0:1161550): avc: denied { read } for name="u:object_r:vendor_camera_prop:s0" dev="tmpfs" ino=5969 scontext=u:r:untrusted_app:s0:c40,c257,c512,c768 tcontext=u:object_r:vendor_camera_prop:s0 tclass=file permissive=0 E/libc: Access denied finding property "vendor.camera.aux.packagelist" W/com.wzt.yolov5: type=1400 audit(0.0:1161551): avc: denied { read } for name="u:object_r:vendor_camera_prop:s0" dev="tmpfs" ino=5969 scontext=u:r:untrusted_app:s0:c40,c257,c512,c768 tcontext=u:object_r:vendor_camera_prop:s0 tclass=file permissive=0 V/Camera: finalize camera I/chatty: uid=10296(com.wzt.yolov5) FinalizerDaemon identical 4 lines V/Camera: finalize camera E/libc: Access denied finding property "vendor.camera.aux.packagelist" W/com.wzt.yolov5: type=1400 audit(0.0:1161552): avc: denied { read } for name="u:object_r:vendor_camera_prop:s0" dev="tmpfs" ino=5969 scontext=u:r:untrusted_app:s0:c40,c257,c512,c768 tcontext=u:object_r:vendor_camera_prop:s0 tclass=file permissive=0 W/com.wzt.yolov5: type=1400 audit(0.0:1161553): avc: denied { read } for name="u:object_r:vendor_camera_prop:s0" dev="tmpfs" ino=5969 scontext=u:r:untrusted_app:s0:c40,c257,c512,c768 tcontext=u:object_r:vendor_camera_prop:s0 tclass=file permissive=0 E/libc: Access denied finding property "vendor.camera.aux.packagelist" E/libc: Access denied finding property "vendor.camera.aux.packagelist" W/com.wzt.yolov5: type=1400 audit(0.0:1161554): avc: denied { read } for name="u:object_r:vendor_camera_prop:s0" dev="tmpfs" ino=5969 scontext=u:r:untrusted_app:s0:c40,c257,c512,c768 tcontext=u:object_r:vendor_camera_prop:s0 tclass=file permissive=0 W/com.wzt.yolov5: type=1400 audit(0.0:1161555): avc: denied { read } for name="u:object_r:vendor_camera_prop:s0" dev="tmpfs" ino=5969 scontext=u:r:untrusted_app:s0:c40,c257,c512,c768 tcontext=u:object_r:vendor_camera_prop:s0 tclass=file permissive=0 E/libc: Access denied finding property "vendor.camera.aux.packagelist" W/com.wzt.yolov5: type=1400 audit(0.0:1161556): avc: denied { read } for name="u:object_r:vendor_camera_prop:s0" dev="tmpfs" ino=5969 scontext=u:r:untrusted_app:s0:c40,c257,c512,c768 tcontext=u:object_r:vendor_camera_prop:s0 tclass=file permissive=0 E/libc: Access denied finding property "vendor.camera.aux.packagelist" D/Camera: Use cases [Preview:androidx.camera.core.Preview-d5d76703-fe25-4b6e-8960-d91d31652e88, ImageAnalysis:androidx.camera.core.ImageAnalysis-bb739da9-3041-43fb-9637-8376b6c3e8e7] ONLINE for camera 0 D/UseCaseAttachState: Active and online use case: [] for camera: 0 D/Camera: Resetting Capture Session Opening camera: 0 D/UseCaseAttachState: All use case: [androidx.camera.core.Preview-d5d76703-fe25-4b6e-8960-d91d31652e88, androidx.camera.core.ImageAnalysis-bb739da9-3041-43fb-9637-8376b6c3e8e7] for camera: 0 E/libc: Access denied finding property "persist.vendor.camera.privapp.list" I/CameraManager: Using legacy camera HAL. E/libc: Access denied finding property "vendor.camera.hal1.packagelist" E/libc: Access denied finding property "vendor.camera.aux.packagelist" E/libc: Access denied finding property "vendor.camera.aux.packagelist" E/libc: Access denied finding property "vendor.camera.aux.packagelist" V/CameraManager: isNormalCamera packageName = com.wzt.yolov5 isTopActivity I/CameraManager: isTopActivity: pkgname: com.wzt.yolov5 V/CameraManager: isNormalCamera isTopActivity true sendOpenCameraBroadCast isNormalCamera = true V/CameraManager: sendStartPreviewBroadCast V/CameraDevice-JV-0: mIsNormalCamera true isNormalCamera true D/Camera: Use case Preview:androidx.camera.core.Preview-d5d76703-fe25-4b6e-8960-d91d31652e88 ACTIVE for camera 0 D/UseCaseAttachState: Active and online use case: [androidx.camera.core.Preview-d5d76703-fe25-4b6e-8960-d91d31652e88] for camera: 0 D/Camera: Use case ImageAnalysis:androidx.camera.core.ImageAnalysis-bb739da9-3041-43fb-9637-8376b6c3e8e7 ACTIVE for camera 0 D/UseCaseAttachState: Active and online use case: [androidx.camera.core.Preview-d5d76703-fe25-4b6e-8960-d91d31652e88, androidx.camera.core.ImageAnalysis-bb739da9-3041-43fb-9637-8376b6c3e8e7] for camera: 0 D/Camera: CameraDevice.onOpened(): 0 D/UseCaseAttachState: All use case: [androidx.camera.core.Preview-d5d76703-fe25-4b6e-8960-d91d31652e88, androidx.camera.core.ImageAnalysis-bb739da9-3041-43fb-9637-8376b6c3e8e7] for camera: 0 D/CaptureSession: Opening capture session. I/CameraDeviceState: Legacy camera service transitioning to state CONFIGURING I/RequestThread-0: Configure outputs: 2 surfaces configured. D/Camera: app passed NULL surface E/libc: Access denied finding property "persist.camera.legacy_perf" I/CameraDeviceState: Legacy camera service transitioning to state IDLE D/CaptureSession: Attempting to send capture request onConfigured Issuing request for session. I/RequestQueue: Repeating capture request set. D/CaptureSession: CameraCaptureSession.onConfigured() mState=OPENED CameraCaptureSession.onReady() V/Camera: finalize camera I/chatty: uid=10296(com.wzt.yolov5) FinalizerDaemon identical 11 lines V/Camera: finalize camera W/LegacyRequestMapper: convertRequestMetadata - control.awbRegions setting is not supported, ignoring value Only received metering rectangles with weight 0. Only received metering rectangles with weight 0. V/Camera: finalize camera finalize camera E/: IProducerListener: malformed binder reply V/Camera: sendStartPreviewBroadCast E/: IProducerListener: malformed binder reply I/CameraDeviceState: Legacy camera service transitioning to state CAPTURING D/skia: onFlyCompress W/ncnn: find_blob_index_by_name 619 failed find_blob_index_by_name 816 failed W/ncnn: find_blob_index_by_name 820 failed A/libc: Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0 in tid 32015 (pool-4-thread-1), pid 31486 (com.wzt.yolov5) Connected to process 32044 on device 'vivo-vivo_x21ud_a-15beca27'. Capturing and displaying logcat messages from application. This behavior can be disabled in the "Logcat output" section of the "Debugger" settings page. I/Perf: Connecting to perf service. I/MultiDex: VM with version 2.1.0 has multidex support Installing application VM has multidex support, MultiDex support library is disabled. D/Camera2Initializer: CameraX initializing with Camera2 ... I/CameraManagerGlobal: Connecting to camera service E/libc: Access denied finding property "vendor.camera.aux.packagelist" I/chatty: uid=10296(com.wzt.yolov5) identical 1 line E/libc: Access denied finding property "vendor.camera.aux.packagelist" W/CameraManagerGlobal: [soar.cts] ignore the status update of camera: 2 E/libc: Access denied finding property "vendor.camera.aux.packagelist" E/libc: Access denied finding property "vendor.camera.aux.packagelist" E/libc: Access denied finding property "vendor.camera.aux.packagelist" D/CameraRepository: Added camera: 0 V/Camera: finalize camera V/Camera: finalize camera D/UseCaseAttachState: Active and online use case: [] for camera: 0 D/CameraRepository: Added camera: 1 D/UseCaseAttachState: Active and online use case: [] for camera: 1 I/FtBuild: getRomVersion mRomVer=9.0 W/com.wzt.yolov5: Accessing hidden method Landroid/graphics/drawable/Drawable;->getOpticalInsets()Landroid/graphics/Insets; (light greylist, linking) Accessing hidden field Landroid/graphics/Insets;->left:I (light greylist, linking) Accessing hidden field Landroid/graphics/Insets;->right:I (light greylist, linking) Accessing hidden field Landroid/graphics/Insets;->top:I (light greylist, linking) Accessing hidden field Landroid/graphics/Insets;->bottom:I (light greylist, linking) W/com.wzt.yolov5: Accessing hidden method Landroid/view/View;->getAccessibilityDelegate()Landroid/view/View$AccessibilityDelegate; (light greylist, linking) W/com.wzt.yolov5: Accessing hidden method Landroid/view/View;->computeFitSystemWindows(Landroid/graphics/Rect;Landroid/graphics/Rect;)Z (light greylist, reflection) W/com.wzt.yolov5: Accessing hidden method Landroid/view/ViewGroup;->makeOptionalFitsSystemWindows()V (light greylist, reflection) V/Camera: finalize camera V/Camera: finalize camera W/com.wzt.yolov5: Accessing hidden method Landroid/widget/TextView;->getTextDirectionHeuristic()Landroid/text/TextDirectionHeuristic; (light greylist, linking) D/OpenGLRenderer: Skia GL Pipeline I/Adreno: QUALCOMM build : 9128d71, Ib33d3e8e13 Build Date : 11/02/18 OpenGL ES Shader Compiler Version: EV031.25.03.01 Local Branch : Remote Branch : Remote Branch : Reconstruct Branch : Build Config : S L 6.0.7 AArch64 I/Adreno: PFP: 0x005ff112, ME: 0x005ff066 I/ConfigStore: android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasWideColorDisplay retrieved: 0 android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasHDRDisplay retrieved: 0 I/OpenGLRenderer: Initialized EGL, version 1.4 D/OpenGLRenderer: Swap behavior 2 W/Binder:32044_3: type=1400 audit(0.0:1163686): avc: denied { read } for name="u:object_r:vendor_camera_prop:s0" dev="tmpfs" ino=5969 scontext=u:r:untrusted_app:s0:c40,c257,c512,c768 tcontext=u:object_r:vendor_camera_prop:s0 tclass=file permissive=0 E/libc: Access denied finding property "vendor.camera.aux.packagelist" D/ViewRootImpl[WelcomeActivity]: onDisplayChange oldDisplayState=2 newDisplayState=1 E/libc: Access denied finding property "vendor.camera.aux.packagelist" D/ViewRootImpl[WelcomeActivity]: onDisplayChange oldDisplayState=1 newDisplayState=3 D/ViewRootImpl[WelcomeActivity]: pokeDrawLockedIfNeeded displayState=3 D/ViewRootImpl[WelcomeActivity]: onDisplayChange oldDisplayState=3 newDisplayState=4 D/ViewRootImpl[WelcomeActivity]: onDisplayChange oldDisplayState=4 newDisplayState=3 D/ViewRootImpl[WelcomeActivity]: onDisplayChange oldDisplayState=3 newDisplayState=4 D/ViewRootImpl[WelcomeActivity]: onDisplayChange oldDisplayState=4 newDisplayState=3 D/ViewRootImpl[WelcomeActivity]: onDisplayChange oldDisplayState=3 newDisplayState=4 D/ViewRootImpl[WelcomeActivity]: onDisplayChange oldDisplayState=4 newDisplayState=3 D/ViewRootImpl[WelcomeActivity]: onDisplayChange oldDisplayState=3 newDisplayState=4

你好,我按您的方法更改了参数,但是在手机上运行yolact的时候点击yolact按钮直接闪退,报如上的错误,大佬有解决办法么

oddityyyy commented 2 years ago

W/ncnn: find_blob_index_by_name 619 failed find_blob_index_by_name 816 failed W/ncnn: find_blob_index_by_name 820 failed A/libc: Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0 in tid 32015 (pool-4-thread-1), pid 31486 (com.wzt.yolov5) Connected to process 32044 on device 'vivo-vivo_x21ud_a-15beca27'. Capturing and displaying logcat messages from application. This behavior can be disabled in the "Logcat output" section of the "Debugger" settings page.

主要是这几行错误我感觉

cmdbug commented 2 years ago
ex.input("input.1", in_net);
ex.extract("619", maskmaps);   // 138x138 x 32
ex.extract("816", location);   // 4 x 19248
ex.extract("818", mask);       // maskdim 32 x 19248
ex.extract("820", confidence); // 81 x 19248

默认代码是这几个,要根据你自己的模型修改啊,用netron看

oddityyyy commented 2 years ago

您好,我修改了: image Yolact.cpp的模型 image Yolact.cpp节点 image Yolact.cpp类别名 image YolactMask.java标签名

但是最终在手机上的检测和分割结果都出错了: image image image image

oddityyyy commented 2 years ago

image 当时训练模型的时候借鉴了别人的,把这个image size从默认的550改成了512,不知道会对结果有影响嘛? 感觉应该是模型的问题好像

oddityyyy commented 2 years ago

image 确实是image size前后匹配的问题,设置为550重新训练了一遍完美运行,感谢大佬的开源代码

afiqmuzaffar commented 2 years ago

image It is indeed a problem of matching the image size before and after. Set it to 550 and retrain it to run perfectly. Thank you for the open source code.

Hi @oddityyyy , would be much appreciate if you could open source you work.. as I have similar challenge as you.

oddityyyy commented 1 year ago

The yolact training process using 550 default. set it and try again. I will open my work next month

oddityyyy commented 1 year ago

图像确实是前后图像大小匹配的问题。将其设置为 550 并重新训练它以完美运行。感谢您提供开源代码。

你好@oddityyyy,如果您能开源您的工作,我将不胜感激。因为我和您面临类似的挑战。

Hello, the latest code I have made public in my repository