anyone converting an onnx to coreml or pytorch to coreml - coremltools

Does anyone convert an onnx to coreml or pytorch to coreml successfully recently? Especially the case where pytorch model is not classifier but a feature extractor.
I tried a lot of ways to do that. But all of them failed either because of non-compatibility or other reasons. I'm desperate for somebody's saving me out of this dilemma.
I tried the latest version of coremltools but get an error shown below
enter image description here
enter image description here
This is the complete error.
TypeError: Input strides has type <class 'coremltools.converters.mil.mil.types.type_tensor.tensor..tensor'> not compatible with expected type IntTensorInputType

Related

How to convert tensorflow-lite model to coreml .mlmodel

I am currently using google firebase integrated with my ios app. I am using MLKit in my app with a local TensorFlow lite model as an image classifier.
But having Xcode 9, I am unable to do this with my app as autoMLVision is new and requires xcode 10.1. Now I think the best thing to do is to convert the TensorFlow lite model, I trained in google firebase and downloaded, to a .mlmodel and use Core ML for image classification.
How would I go about doing this conversion. If you have an alternate way of solving this version problem, please share. Tell me if you need more information.
As far as I know, you cannot currently convert a TFLite model directly to Core ML. You can only convert frozen .pb models using tfcoreml.
One option might be to convert the TFLite model back to a frozen .pb model (not sure if there are conversion tools that let you do this).
Another option is to do the conversion by hand, using coremltools' NeuralNetworkBuilder. You will need to read the TFLite file, extract the weights, potentially transpose them into the order that Core ML expects, and then build the Core ML version of the model using NeuralNetworkBuilder.

gensim save load model deprecation warning

I get the following deprecation warning when saving/loading a gensim word embedding:
model.save("mymodel.model")
/home/.../lib/python3.7/site-packages/smart_open/smart_open_lib.py:398:
UserWarning: This function is deprecated, use smart_open.open instead.
See the migration notes for details:
https://github.com/RaRe-Technologies/smart_open/blob/master/README.rst#migrating-to-the-new-open-function
'See the migration notes for details: %s' % _MIGRATION_NOTES_URL
I don't understand what to do following the notes on the page.
So, how should I save and open my models instead?
I use python 3.7 , gensim 3.7.3. and smart_open 1.8.4. I think I did not get the warning when using gensim 3.7.1. and python 3.5. smart_open should have been 1.8.4.
You can ignore most "deprecation warnings", as they're just an advisory about underlying changes that for now still work, but there's a new preferred way to do things that may be required in the future.
In this case, the warning is about a function inside the smart_open package that the gensim package is using. That is, it's not the .save() you are calling that's deprecated, but something inside .save(). The gensim authors will eventually update .save() to use the newly-preferred variant of what smart_open offers.
You can just keep using .save(), ignoring the message as long as things still work for you – unless you'd like to contribute the fix to .save() to remove the warning to gensim. (It may, however, have already been fixed in the development code, to become available in the next gensim release.)

Is there a way to import an ArgoUML model into Modelio?

I'm trying to migrate an ArgoUML file to Modelio. According to my understanding, both support XMI, but somehow this still doesn't work. When I export my ArgoUML data to XMI, Modelio won't import it, I get the following error:
Failed: file content is not recognized as a valid model.
So.. is there a way to get around this? ArgoUML is version 0.34, Modelio is version 3.1
In fact the formats supported by both tools are different.
ArgoUML exports in UML1.4/XMI 1.1 format and Modelio imports in UML2.x/XMI2.x format (adopted in 2005...), that's why your ArgoUML exports are not recoginized by Modelio import.
Obviously one workaround would be to transform UML1.4/XMI1.1 in, at least, UML2.1.1/XMI2.1... I just google "transform UML 1.4 2.1" and I found the following site but I did not test it!!!

GhostScript on CentOS 5.3 - Unable to process JPXDecode data

I'm trying to get our server to convert PDFs to image files. It's a CentOS 5.3 system and the latest version of ghostscript that can be (8.70), has been installed.
When I try to convert a PDF I get the following error repeated for each page, and the result is a load of blank images.
**** ERROR: Unable to process JPXDecode data. Page will be missing data.
So, I found an answer on here that seemed to answer that question:
iText PDF; howto convert jpeg2000 to jpg using Java
Following that I downloaded iText 5.3.4 and jai_imageio-1.1.jar and compiled the supplied script on my local machine. When I run the final conversion command on my PDF I get:
java.lang.NullPointerException
at com.itextpdf.text.pdf.parser.PdfImageObject.decodeImageBytes(PdfImageObject.java:296)
at com.itextpdf.text.pdf.parser.PdfImageObject.<init>(PdfImageObject.java:199)
at com.itextpdf.text.pdf.parser.PdfImageObject.<init>(PdfImageObject.java:158)
at PDFConverter.hasJpeg2000(PDFConverter.java:36)
at PDFConverter.main(PDFConverter.java:15)
Doesn't contain any JPEG2000 images: Nothing to be done...
I'm not sure whether that's definitely saying that the PDF doesn't have any JPEG2000 images, or whether I've done something wrong when I compiled the script. Perhaps I've got the wrong version of iText since no links were provided in the answer to that other question.
So now I either need help to convert my PDFs to remove any JPEG2000 images, or I need help to get our server running ghostscript properly.

Error with trained LBP cascade in OpenCV 2.4 on OSX lion

I am trying to train cascade based on this post and official documentation.
My gear is:
Mac OSX Lion
OpenCV 2.4.0
So, I have created negative images, positive samples and trained cascade, all without errors, however when I try to test created cascade using opencv_performace I got following error:
OpenCV Error: Unspecified error (The node does not represent a user object (unknown type?)) in cvRead, file /Users/tekielskib/Projects/Wprawki/OpenCV-2.4.0/modules/core/src/persistence.cpp, line 4863
terminate called throwing an exceptionAbort trap: 6
Same thing happens when I create Haar cascade and save it using -baseFormatSave switch.
I am kind of stumped and don't know haw to nail down the issue...
See http://code.opencv.org/issues/1694
There are two versions of xml format for cascades in OpenCV and the new format of cascades is not supported by the opencv_performance. But LBP cascades are only exist in newer format.

Resources