Skip to content

v1.2

Latest
Compare
Choose a tag to compare
@doguilmak doguilmak released this 31 Aug 14:25
· 44 commits to main since this release
203f27f

Migration from Version 1.1 to 1.2

Version: 1.2

Summary of Changes:

1. Added Precision Configuration:

  • Introduced the coord_precision parameter in the __init__ method, allowing configuration of the number of decimal places for geographic coordinates. The default is 9 decimal places.

2. Error Handling:

  • Added error handling for opening the TIFF file with a try-except block to raise a ValueError if the file cannot be opened.
  • Added error handling for model inference with a try-except block to raise a RuntimeError if the model prediction fails or any other exception occurs during processing.

3. Enhanced Geographic Coordinates Formatting:

  • Geographic coordinates are now formatted according to the coord_precision parameter, providing more control over output precision.

4. Improved Output Information:

  • Updated the CSV column name from "Probability" to "Confidence Score".
  • Updated print statements to use a consistent format for confidence scores and bounding box centers, including improved formatting for bounding box center coordinates.

5. Code Cleanup and Documentation:

  • Improved code comments and docstrings for clarity and consistency.
  • Added example usage for the new coord_precision parameter in documentation.

Detailed Changes:

  • Constructor (__init__ method):

    • Added coord_precision parameter:
      def __init__(self, tif_path, model_path, coord_precision=9):
    • Added error handling for TIFF file opening:
      try:
          with rasterio.open(self.tif_path) as dataset:
              self.image_width = dataset.width
              self.image_height = dataset.height
      except rasterio.errors.RasterioIOError as e:
          raise ValueError(f"Error opening TIFF file {self.tif_path}: {e}")
  • Process Image Method:

    • Added error handling for model loading and inference:

      try:
          model = YOLO(self.model_path)
          results = model.predict(self.tif_path)
      except Exception as e:
          raise RuntimeError(f"Error during model inference: {e}")
    • Updated geographic coordinates formatting to use coord_precision:

      formatted_geographic_coords = np.array([
          [f'{lat:.{self.coord_precision}f}', f'{lon:.{self.coord_precision}f}']
          for lat, lon in geographic_coords
      ])
    • Updated CSV column name and print statements:

      "Confidence Score": box.conf[0].item()
    • Added error handling for image processing:

      except Exception as e:
          raise RuntimeError(f"Error processing the image: {e}")