Open quantum-fusion opened 3 years ago
I'm 100% not sure what the issue is here, but you could have forgotten to add the project target to the Resnet50.swift
file. Let me know if adding a target to the file works.
@rickwierenga If you notice I included a Resnet50.mlmodel. The Resnet50.swift file that you reference was not included, and if you check your project ClassificationRequest.swift file it is empty. I believe that your ClassificationRequest function is not complete. The way of loading the Resnet50.mlmodel is correct as far as I can tell, but it isn't clear how your ClassificationRequest function should work since I believe the part to load the model belongs there. Please explain. I don't think your project is complete.
@rickwierenga I checked your writeup article (https://heartbeat.fritz.ai/deploying-core-ml-models-using-vapor-c562a70b1371), and your GitHub code, and the file that you reference Resnet50.swift is missing. Therefore your example will not compile. This is the error. Can you please update the project and compile it without errors?
I did not reference Resnet50.swift anywhere in the tutorial. It is automatically generated by Xcode when you add "App" as a target to the file. You can do this by selecting the file using the file navigator, and pressing alt+command+1. Then find App under Target Membership and make sure it is checked.
If the issue persists, try deleting the Resnet50.mlmodel and adding it again. Make sure "Copy items if needed" is check, and you set up the targets correctly.
Hope that helps.
I tried adding the Resnet50.mlmodel and adding target membership on MACBook but the command alt+command+1 does not work on MAC, because there is no ALT key. (https://developer.apple.com/forums/thread/662596) see article, but this did not work. The problem of adding a file to a project is that the Xcode has no option for adding a a machine learning model. The second problem I can see is that the CoreML-API project does not have a project file .xcworkspace
If you could please upload your project with the resnet50 model available and a complete .xcworkspace, it would be better to allow me to clone your GITHUB repo than trying to resolve environment and differences in the Xcode platform, because it sounds like you are running on Windows not MAC.
See the example I have provided from Apple that has added the Resnet50 model. This project example has a .xcodeproj file that allows me to add the target membership of the resnet50 model by simply dragging it into the desktop Xcode workspace. (https://developer.apple.com/documentation/vision/classifying_images_with_vision_and_core_ml).
@rickwierenga I think the problem is really only that your GitHub repo doesn't have the Xcode project workspace. Other than that me adding the resnet50 model would work just fine dragging it into the project like I did with the example shown. Could you add the Xcode project workspace for CorML-API ? I think that is the actual problem, the project that you provided from GitHub doesn't have a project workspace file. When I opened the project, I did it by %open Package.swift, instead of clicking on the CoreML-API project workspace file which is missing.
I understand that you didn't want to upload the Resnet50 file because of its model size which is too large due to a Github limitation.
@rickwierenga I figured out how to make a Xcode project workspace(%cd ~/heartbeat-tutorials-master/CoreML-API/CoreML-API swift package generate-xcodeproj )
@rickwierenga It says there are errors related to dependencies. (see attached)
@rickwierenga I discovered a bug on macOS related to the libressl dylib versioning with the linker. I have opened a ticket with vapor to see if they have a potential workaround. (https://github.com/vapor-community/postgresql/issues/77)
@rickwierenga Have you seen this dylib dependency error on MACOS Big Sur? I was able to add the resnet50 model as membership to the project, and create the xcodeproj workspace.
I was able to download the Resnet model and create the xcodeproject file. % swift package generate-xcodeproj % xcodebuild -list -project CoreML-API.xcodeproj % xcodebuild -scheme Run build
@rickwierenga I tried %brew install libressl However it does not install the correct version of libssl.dylib and libcrypto.dylib with the clang linker version 11.0 or newer, it is still relying on stale dependencies from clang version 10.10 which are out of date. Any idea where to get the newest dependencies?
@rickwierenga I tried 1%brew upgrade vapor (https://github.com/vapor/vapor/issues/2104) I tried 2%brew reinstall openssl postgres (https://stackoverflow.com/questions/27264574/import-psycopg2-library-not-loaded-libssl-1-0-0-dylib)
Both 1 and 2 failed, with out upgrading the dependencies.
@rickwierenga I have alerted the vapor team (https://github.com/vapor/vapor/issues/2104)
@rickwierenga It is a possibility that the package.swift file is out of date with the wrong version of vapor. See issue (https://github.com/vapor/vapor/issues/2104). Developer states he has removed all openssl dependencies yet your project is trying to resolve openssl and libressl libraries with dylib for crypto.
@rickwierenga I tried to fix the errors with CIContext and CIImage, by upgrading to vapor4, however the upgrade is more involved. See response from vapor developer. (https://github.com/vapor/vapor/issues/2104)
@rickwierenga The developer of vapor points out that your project is using vapor3, not vapor4, and the Package.swift file is out of date. He recommends that you upgrade this example project using Vapor4 examples (https://docs.vapor.codes/4.0/upgrading/). See communication history on this issue. (https://github.com/vapor/vapor/issues/2104)
@rickwierenga Also he points out that he needs Swift 5.3. What version of swift are you using?
@rickwierenga I tried your demo project, and found that the code has an error, and couldn't find the resnet50 model, so I downloaded the model from Apple. Even after installing the model, I see that your classifier code handler has missing code. I am not sure of the fix, but wanted to better understand your code example. I am interested, and have attached a screen shot from Xcode showing the error.