Views
No views yet
1from PIL import Image
2
3def create_comparison_image(img1_path, img2_path):
4 # Open images
5 img1 = Image.open(img1_path).convert("RGB")
6 img2 = Image.open(img2_path).convert("RGB")
7
8 # Resize to same height
9 height = max(img1.height, img2.height)
10 width1 = int(img1.width * (height / img1.height))
11 width2 = int(img2.width * (height / img2.height))
12
13 img1 = img1.resize((width1, height), Image.LANCZOS)
14 img2 = img2.resize((width2, height), Image.LANCZOS)
15
16 # Create new image with space for both images
17 total_width = width1 + width2
18 comparison = Image.new('RGB', (total_width, height))
19
20 # Paste images side by side
21 comparison.paste(img1, (0, 0))
22 comparison.paste(img2, (width1, 0))
23
24 return comparison| Training Loss | Epoch | Step | Validation Loss | Accuracy |
|---|---|---|---|---|
| 0.3114 | 0.9991 | 470 | 0.1464 | 0.9477 |
| 0.2831 | 1.9991 | 940 | 0.0803 | 0.9697 |
| 0.2806 | 2.9991 | 1410 | 0.0727 | 0.9756 |
| 0.2779 | 3.9991 | 1880 | 0.0744 | 0.9758 |
| 0.2588 | 4.9991 | 2350 | 0.0659 | 0.9762 |