jveitchmichaelis / deeplabel

A cross-platform desktop image annotation tool for machine learning
205 stars 39 forks source link

cocoimporter breaks build on windows and linux #14

Closed chrisrapson closed 4 years ago

chrisrapson commented 4 years ago

the square brackets in cocoimporter.cpp are breaking the build on windows and linux.

On linux I was able to checkout the previous commit and get everything working. On windows I am still having issues with OpenCV. (I think that has more to do with me vs windows than anything else.)

I also hit issues with QtAwesome during both builds, and had to download it from a different repository (https://github.com/gamecreature/QtAwesome). Unless I'm doing something wrong there too, you might want to list it as a dependency in your installation instructions.

P.S. excellent tool by the way!

jveitchmichaelis commented 4 years ago

For QtAwesome: git submodule update --init --recursive should do. It's a submodule in the repository.

I'll have a look at the brackets. Can you post the compile error you get?

And on OpenCV are you using version 4?

(By the way is there a reason you need to build from scratch on Windows? The latest releases should work out of the box)

chrisrapson commented 4 years ago

The windows releases only seem to go up to v0.12. In that release I couldn't import existing labels.

I was using OpenCV version 4.0 on windows and 4.3 on linux. I could try a different version if that makes a difference.

The compile error is:

src/cocoimporter.cpp:15:27: error: no match for ‘operator[]’ (operand types are ‘QJsonDocument’ and ‘const char [11]’)
     auto categories = json["categories"];

and similar for lines 25, 29, 41, 54......

P.S. thanks for the tip about the submodule update command

jveitchmichaelis commented 4 years ago

Oh ok, I can upload a more recent release if you need. It's not automated at the moment. I think you can use 0.13 (just download the exe and copy it into the 0.12 folder), 0.14 was just to force Zenodo to assign a doi.

Let me know how you get on with Linux, it may be a missing qt component or something odd.

chrisrapson commented 4 years ago

Everything runs just fine in linux after I rolled back the git commit that introduced of the square brackets. git checkout 757ecc4259574e886954151a812de2fbe6f4e205

I'm not seeing an exe file in the zip for 0.13 or 0.14. Am I missing something? Unfortunately other people I work with are restricted to windows, otherwise I'd just use the linux version.

jveitchmichaelis commented 4 years ago

Ah true, I'll upload a 0.14 release.

Is it possible your version of Qt is old? I may be using a more recent version if you're using it from a package manager. I can check what I'm using.

https://doc.qt.io/qt-5/qjsondocument.html#operator-5b-5d

You need 5.10 or later. I'll add this to the readme.

But.. it looks like I may be able to use a different syntax to improve back compatibility.

You can try using .value(key) instead of square brackets, eg json.object().value("categories").

EDIT: If you try this, you also need to include #include <QJsonObject> and you need to replace the other calls with.toObject().value(key).

Ok - this seems to work fine for me on a COCO project.

jveitchmichaelis commented 4 years ago

Give that a go: https://github.com/jveitchmichaelis/deeplabel/releases/tag/v0.15

https://github.com/jveitchmichaelis/deeplabel/commit/0a2078039a6f9c38d1ef31f07585f661617a7bb1

chrisrapson commented 4 years ago

I think you're right about the Qt version. I have 5.9.5, which is the latest in the repo for the Ubuntu LTS 18.04.

The exe file in the 0.15 zip file seems to be working nicely, thanks! :-) I'll close this issue now.