ESA-PhiLab / iris

Semi-automatic tool for manual segmentation of multi-spectral and geo-spatial imagery.
GNU General Public License v3.0
130 stars 41 forks source link

Incompatibilities with newer Flask and lightgbm packages #60

Closed LeoBreebaart closed 1 month ago

LeoBreebaart commented 2 months ago

We are running IRIS in a NixOS environment that, after its most recent update, no longer contains versions of several dependency packages that IRIS requires, most notably Flask v2 and lightgbm v3.

Specifically:

Are there any plans to update the IRIS code base for these and other newer dependencies?

Regards,

-- Leo

aliFrancis commented 2 months ago

Thanks for this! There have indeed been issues with LightGBM versioning for a while. I am at IGARSS this week but hopefully I will have time to look into this more closely next week. It sounds like you've identified the problem, though. Would you like to make a PR with an updated requirements? If not I can do it but may ask for your feedback to make sure I've resolved it.

LeoBreebaart commented 2 months ago

Thanks for the quick reply! I have submitted a pull request containing my fix for Flask, which is entirely syntactical.

However, I am not myself an actual user of either lightgbm or Iris (I merely manage the environment from which an Iris instance is provided to end users). I would say that simply removing that early_stopping_rounds parameter from the fit() call would be enough to avoid the runtime error -- but I can't judge how relevant the value of that parameter (which was set to 4 in segmentation/__init__.py) is, and I was not able to quickly find out how lightgbm expected us to implement that functionality after that parameter mechanim was deprecated. I can find some talk about callback functions on Stack Overflow, but no real concrete "this is the upgrade/migration path for this deprecation".

Regards,

-- Leo

aliFrancis commented 1 month ago

Great, thanks. I've merged the PR and I will implement the early_stopping callback - seems that's the recommended way now. Will update here and close when it's done

aliFrancis commented 1 month ago

Fixed

    early_stopping = lgb.early_stopping(4, verbose=False)
    gbm.fit(
        inputs[train_indices, :], train_labels,
        eval_set=[(inputs[val_indices, :], val_labels)],
        callbacks=[early_stopping]
    )