Git Product home page Git Product logo

Comments (5)

zigaLuksic avatar zigaLuksic commented on July 22, 2024

The examples in the https://github.com/sentinel-hub/eo-learn-examples are outdated.

The PointSamplingTask was removed in eo-learn 1.0, where it was replaced with FractionSamplingTask (controls sampling via mask) and BlockSamplingTask (can also sample larger blocks from array). From a quick glance FractionSamplingTask is what you're looking for, though the interface is slightly different.

from eo-learn.

richardburcher avatar richardburcher commented on July 22, 2024

Thanks:)

I updated signature to below but am not be assigning correct labels back to EOPatches ... this is more my fault at this point as I am not very familiar with the library and plan to dig into basics first.

Just wondering if eo-learn-examples will be updated in future?

sampling_task = FractionSamplingTask(
    fraction=0.10,
    sampling_feature=(FeatureType.MASK_TIMELESS, LABELS[1]),
    features_to_sample=[(FeatureType.DATA, "FEATURES", "FEATURES_SAMPLED")]
)

from eo-learn.

batic avatar batic commented on July 22, 2024

Just wondering if eo-learn-examples will be updated in future?

We have plenty of ideas, and even longer wishlist, but not enough time for all of them... I hope that yes, we will update the examples repo, but until then, we'd appreciate help. Pull requests welcome!

from eo-learn.

zigaLuksic avatar zigaLuksic commented on July 22, 2024

I tried running the notebook to see how to aid you. Since there is no inherent filtering done in sampling, it is better to use BlockSamplingTask (otherwise some things break further in the notebook since not all eopatches have the same number of samples)

sampling_task = BlockSamplingTask(
    amount=100,
    features_to_sample=[
        (FeatureType.DATA, "FEATURES", "FEATURES_SAMPLED"),
        (FeatureType.MASK, "IS_DATA", "IS_DATA_SAMPLED"),
        (FeatureType.MASK_TIMELESS, "water_label", "water_label_SAMPLED"),
    ],  # tag fields to sample
)

The new tasks don't rename automatically so I had to pass them renaming schemas.

The next cell is also outdated, but I tried fixing it with minimal adjustments. It requires you to load linearly_connect_tasks and EOWorkflow.

# Define the workflow
eonodes = linearly_connect_tasks(load_task, extract_task, ndwi_task, ndmi_task, merge_task, sampling_task, save_task)
load_node, _, _, _, _, sampling_node, save_node = eonodes
workflow = EOWorkflow(eonodes)

We need the nodes because execution arguments are now linked to nodes, not tasks. Also since the EOPatches are old, you'll get a ton of warnings, but it's safe to ignore them.

%%time
import warnings

# Create list of arguments to be passed at run-time
execution_args = []
for idx, eop_name in enumerate(eopatch_names):
    execution_args.append(
            {load_node: {"eopatch_folder": eop_name}, sampling_node: {"seed": idx}, save_node: {"eopatch_folder": eop_name}}
        )

with warnings.catch_warnings():
    warnings.simplefilter("ignore")
    # Execute workflow in parallel, e.g. each EOPatch is process in parallel in dedicated processes
    executor = EOExecutor(workflow, execution_args, save_logs=True)
    executor.run(workers=N_WORKERS, multiprocess=True)

# Make report to check possible failures
executor.make_report()

And the rest worked for me.

Another note, sometime next week a new eo-learn version will release. If you wish to run this example stay on your current version, because the new one will no longer load the outdated eopatches used here.

from eo-learn.

zigaLuksic avatar zigaLuksic commented on July 22, 2024

Example has since been updated.

from eo-learn.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.