update jenkins and files to run automatically

This commit is contained in:
Karol Cyganik 2024-03-20 12:58:03 +01:00
parent 43fe39852c
commit 03070c7f4d
3 changed files with 28 additions and 8 deletions

23
Jenkinsfile vendored
View File

@ -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
}
}
}
}
}

View File

@ -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

View File

@ -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()