Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 18, 2025

Plan to replace hardcoded resize strategy with model configuration value:

  • Understand the current codebase and identify where resize strategy is hardcoded
  • Modify Classifier class to expose the resize_strategy from model config
  • Update app.py to use the resize strategy from the classifier instead of hardcoded value
  • Test the changes to ensure they work correctly
  • Run code review and security checks
Original prompt

This section details on the original issue you should resolve

<issue_title>experiment with different resizing size</issue_title>
<issue_description>Currently we're using the default values for input image resize, ranging around 230 (see resize_size values in https://pytorch.org/vision/main/_modules/torchvision/models/convnext.html). However the paper (https://arxiv.org/pdf/2201.03545) reports in table 1 that a higher resolution generally leads to better performance. We'd like to see if the case hold for our data as well.
</issue_description>

<agent_instructions>this is simply replacing redundant variable definition with a single source of truth. </agent_instructions>

Comments on the Issue (you are @copilot in this section)

@keighrim v8.0 development included experiment with three different preprocessors https://github.com/clamsproject/app-swt-detection/blob/c4f516482aac7b02394e6af673bb350b7b7c3eee/modeling/data_loader.py#L50-L66

and multiple rounds of grid searches reported distorted is empirically the best choice, hence the v8.0 model was released after trained with distorted training document, and the inference also use the same resizing strategy

app-swt-detection/app.py

Lines 122 to 123 in c4f5164

resizer = ImageResizeStrategy.get_transform_function('distorted')
resized = torch.stack(tuple(map(resizer, extracted)))

Looking at the code now, I think we can do better by not hardcoding the resizer name in the app.py . This issue will be closed when app.py is updated and automatically decide the resizer name based on model configuration. </comment_new>


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

- Added resize_strategy attribute to Classifier class that reads from model config
- Updated app.py to use classifier.resize_strategy instead of hardcoded 'distorted'
- Falls back to 'distorted' if not specified in config for backward compatibility

Co-authored-by: keighrim <9062727+keighrim@users.noreply.github.com>
@keighrim keighrim marked this pull request as ready for review November 18, 2025 18:26
@keighrim keighrim merged commit f956f62 into main Nov 18, 2025
@keighrim keighrim deleted the copilot/experiment-with-resizing-size branch November 18, 2025 18:26
Copilot AI requested a review from keighrim November 18, 2025 18:26
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

Successfully merging this pull request may close these issues.

experiment with different resizing size

2 participants