Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Imagery does not load and render in the labelling window #57

Open
dbuscombe-usgs opened this issue Aug 13, 2024 · 2 comments
Open

Imagery does not load and render in the labelling window #57

dbuscombe-usgs opened this issue Aug 13, 2024 · 2 comments

Comments

@dbuscombe-usgs
Copy link
Member

I have made doodler python conda environments following the posted instructions (py38) as well as envs based on python versions 3.7, 3.9, and 3.10. I also trialled firefox, chrome and edge browsers. I made environments using WSL on windows 11 and windows 10 (2 different machines). Each time, I ran into the same issue. When I select an image, and navigate to the labeling screen, the image does not appear.

I suspect something is going wrong with the timing

dcc.Interval(id='interval-component', interval=500, n_intervals=0)]),

@2320sharon investigated this some (thank you) and her summary is below:

In update_output which is called periodically to update the figure I configured it to display the default image if the select_image_value (which is the filename of the image selected by the user to label) is None. When I did this the main page kept updating to the default image even after I selected an image which displayed for a second then updated to the default image.

Something is causing select_image_value to be set to None and update_output is being called every 500ms causing the main figure to clear the image. The question is why is select_image_value being cleared

I can't seem to figure out where select_image_value is from. I can only find it defined in the update_output function where it is passed in as a variable

@dbuscombe-usgs
Copy link
Member Author

select_image_value is inherited from the UI components and is present in the callback. Plotly works by funneling all inputs, outputs, and states, into a single callback function

It is set by Input("select-image", "value"), below

@app.callback(
    [
    Output("select-image","options"),
    Output("graph", "figure"),
    Output("image-list-store", "data"),
    Output("masks", "data"),
    Output('my-div', 'children'),
    Output("segmentation", "data"),
    Output('thisimage_output', 'value'),
    Output("pen-width-display", "children"),
    Output("theta-display", "children"),
    Output("mu-display", "children"),
    Output("crf-downsample-display", "children"),
    # Output("crf-gtprob-display", "children"),
    Output("rf-downsample-display", "children"),
    Output("numscales-display", "children"),
    Output("classified-image-store", "data"),
    ],
    [
    Input("upload-data", "filename"),
    Input("upload-data", "contents"),
    Input("graph", "relayoutData"),
    Input(
        {"type": "label-class-button", "index": dash.dependencies.ALL},
        "n_clicks_timestamp",
    ),
    Input("crf-theta-slider", "value"),
    Input('crf-mu-slider', "value"),
    Input("pen-width", "value"),
    Input("crf-show-segmentation", "value"),
    Input("crf-downsample-slider", "value"),
    Input("rf-downsample-slider", "value"),
    Input("numscales-slider", "value"),
    Input("select-image", "value"),
    Input('interval-component', 'n_intervals'),
    ],
    [
    State("image-list-store", "data"),
    State('my-id', 'value'),
    State("masks", "data"),
    State("segmentation", "data"),
    State("classified-image-store", "data"),
    ],
)

@dbuscombe-usgs
Copy link
Member Author

I tried switching backend server, from flask

server = Flask(__name__)
app = dash.Dash(server=server)

to

app = dash.Dash()
server = app.server

but that did not fix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant