Fix neural denoise/upscale grouping logic when input image is not the group leader#21368
Fix neural denoise/upscale grouping logic when input image is not the group leader#21368jeffc wants to merge 2 commits into
Conversation
|
What happens when you ungroup? Does it break the "image leader" away from the group that it already belonged to?
The group ID is the image ID of the group leader. All ungrouped images are basically groups of 1 since the image id and group id are the same. I'm concerned about side effects of grouping an image in a separate group with a member of another group. While the current situation may not be the most "correct" grouping, the generated image is in the same group as the original image and in most cases (dependent on sorting) will appear next to it in lighttable. |
|
@wpferguson Based on my read of the code, the situation you're describing (grouping an image in a separate group with a member of another group) is the current state, and this PR fixes that behavior. Say image id 001 and 002 are in a group, with 001 being the leader. That means that the group id for that group would be 001. If we run neural denoise on image 002 to create 003, the current code assigns that image to a group with ID 002, which isn't the same group as the original two images. This fix looks up the group ID for the source image (in this case, the source image being 002 with a group ID of 001) and assigns the new image to the correct group, 001. Ungrouping then would work as normal (if we remove 003 from the group, it becomes its own group with ID 003) Testing the current behavior confirms that this is the case -- on Am I missing something? |
|
I think the correct behavior is to group the denoised image with the source image. Let's say you are shooting the interior of a house with only RAWs. You group the images by room. You pick one of the images in a group to denoise and it gets grouped with the "source" image. You ungroup the "source" image from the room group. The source and the denoised result should be grouped together, IMO. If we make the denoised image part of the "parent" group, then the source image could be removed and the denoised image would still be part of the group, but with no "source" image. |
|
That reasoning makes sense to me, but that would mean a different bug fix -- basically, it would mean allowing nested groups in darktable, which is a bigger conceptual change. As things stand now, the behavior is broken in a really unintuitive way:
This is a really confusing flow for users, especially considering that the behavior if I see a few different options here:
What I'm doing in this PR (option 1 above) feels to me like the best solution. If you'd like I can open a bug and move this discussion there. |
I think this probably needs to be an RFC. I don't know if we really want to mess with rewriting grouping (or trying to get a consensus of what it should look like 😁 ). However, if we do decide to redo grouping, I would suggest functional tagging (darktable|group|UUID) which would allow groups of groups and persistence (via XMP sidecars) across database instances. EDIT: I can live with this PR. Maybe for 5.8 we need to do an RFC about grouping and what it should look like and how it should work. |
Sounds good to me. I think there's an interesting discussion to be had about the "intended" function of groups (and obviously, people are going to use them however they want). Personally, I shoot RAW+JPEG, and I rely on grouping to keep the two formats together for each picture. I can see a world where there's the idea of "a shot" -- which could have different formats, denoised+original, copies with different edit histories, etc) -- independent of "a group" (which could contain multiple shots). It's definitely worth discussing more though. |
|
@wpferguson looks like there is a real UX trade-off. As I read it, there are three options:
One thing worth noting: the pre-PR code ( My two cents: 1 is the smallest fix to the silent-orphan case. 2 and 3 are behavior changes worth their own discussion. Probably, would be good to have it noted in the source so the next person who looks at this knows it's a deliberate choice rather than the easiest path. |
|
@andriiryzhkov I agree, 1 is the way to go for now. Anything thing else is going to take a lot of thought trying to cover all the bases. |
This PR fixes a bug in the neural_restore functions (raw denoise, denoise, and upscale) where the result of the operation would not be grouped with the input image unless the input image was its group leader. Image groups in darktable are identified by their group leader (see src/common/grouping.c). Previously, the "group with original" logic was just calling
dt_grouping_add_to_group()with the input image's ID, which isn't necessarily the same as the input image's group ID.disclosure: bug identified and fixed in part by AI tools with close human supervision