Skip to content

Update test_in_custom.py #53

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

ideepankarsharma2003
Copy link

@ideepankarsharma2003 ideepankarsharma2003 commented Mar 31, 2025

PR Title: Fix DataLoader Reference, Remove Duplicates & Optimize Inference

Summary of Changes:

Fixed DataLoader Reference: Replaced valid_loader with data_loader for consistency and correctness.
Optimized Inference: Ensured proper indexing and thresholding for attribute predictions.
Fixed Missing Import: Added os import in CustomDataset.
Removed Unused Variables: Eliminated loss_meter and gt_list to improve efficiency.
Improved JSON Output: Restructured prediction storage for better readability.

Code Fix Example:

for step, (imgs, imgname) in enumerate(valid_loader):  # ❌ Incorrect

⬇️

for step, (imgs, imgname) in enumerate(data_loader):  # ✅ Fixed

Why This Matters:

  • Prevents NameError if valid_loader is undefined.
  • Reduces redundancy and enhances performance.
  • Ensures correct attribute mapping and JSON output.

Testing & Verification:

  • Confirmed data_loader is properly initialized before usage.
  • Validated model inference and attribute predictions.

🚀 Ready for Review! Let me know if any refinements are needed.

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.

1 participant