diff --git a/Jenkinsfile b/Jenkinsfile index 4d75cc0..a8472f6 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,10 +1,27 @@ pipeline { agent any + stages { - stage('Stage 1') { + stage('Checkout') { steps { - echo 'Hello world!' + // Clone the public repository + git url: 'https://git.wmi.amu.edu.pl/s495715/iumKC.git' + } + } + + stage('Run Python Script') { + steps { + // Execute the main.py script + sh 'python3 main.py' + } + } + + stage('Archive Artifacts') { + steps { + // Archive any artifacts generated by the script + // Adjust the path according to your script's output + archiveArtifacts artifacts: './football_dataset/*', fingerprint: true } } } -} \ No newline at end of file +} diff --git a/data.py b/data.py index 63561be..302d047 100644 --- a/data.py +++ b/data.py @@ -112,7 +112,8 @@ def get_data(): api.dataset_download_files(dataset_slug, path=download_dir, unzip=True) all_images = glob(download_dir + "/images/*.jpg") - all_paths = [path.replace(".jpg", ".jpg___fuse.png") for path in all_images] + all_paths = [path.replace(".jpg", ".jpg___fuse.png") + for path in all_images] return all_images, all_paths @@ -134,7 +135,7 @@ def calculate_mean_std(image_paths): return mean, std -def plot_random_images(indices, data_loader): +def plot_random_images(indices, data_loader, suffix='train'): plt.figure(figsize=(8, 8)) for i, index in enumerate(indices): image, label_map = data_loader.dataset[index] @@ -148,4 +149,6 @@ def plot_random_images(indices, data_loader): plt.imshow(label_map) plt.axis("off") - plt.show() + # Save the figure to a file instead of displaying it + plt.savefig(f'random_images_{suffix}.png', dpi=250, bbox_inches='tight') + plt.close() # Close the figure to free up memory diff --git a/main.py b/main.py index c79c48b..40c9ba3 100644 --- a/main.py +++ b/main.py @@ -29,8 +29,8 @@ def main(): train_indices = random.sample(range(len(train_loader.dataset)), 5) test_indices = random.sample(range(len(test_loader.dataset)), 5) - plot_random_images(train_indices, train_loader) - plot_random_images(test_indices, test_loader) + plot_random_images(train_indices, train_loader, 'train') + plot_random_images(test_indices, test_loader, 'test') statistics = SegmentationStatistics(all_paths, train_loader, test_loader, mean, std) statistics.count_colors() statistics.print_statistics()