internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: scoutapp/scout_apm_python

Issue:
Celery: Unhanded exception in `task_prerun_callback`
Using celery-batches 0.2.0, celery 4.4.7, python 3.10, redis backend

What happens: Request with missing `delivery_info` raises error. This bubbles up to sentry, another tool.

Expected behavior: Drop the trace is unless error reporting is enabled on scout-apm.

```
AttributeError: 'NoneType' object has no attribute 'get'
  File "celery/utils/dispatch/signal.py", line 288, in send
    response = receiver(signal=self, sender=sender, **named)
  File "scout_apm/celery.py", line 60, in task_prerun_callback
    tracked_request.tag("is_eager", delivery_info.get("is_eager", False))
```

```
{
args: [
[
<celery_batches.SimpleRequest object at 0x7fbd1f2f9720>, 
<celery_batches.SimpleRequest object at 0x7fcd15dd65e0>, 
<celery_batches.SimpleRequest object at 0x7fad18d6fa30>, 
<celery_batches.SimpleRequest object at 0x7fed14d6e1a0>, 
<celery_batches.SimpleRequest object at 0x7fad13d6e230>
]
], 
kwargs: {}, 
sender: <@task: project.app.jobs.track_happening of project at 0x2faa2c2713f0 (v2 compatible)>, 
signal: <Signal: task_prerun providing_args={'args', 'kwargs', 'task', 'task_id'}>, 
task_id: '684c6b14-4349-42e7-bc8d-4d410bceb1c9'
}
```



Discussion:

Resolving patch:
diff --git a/src/scout_apm/celery.py b/src/scout_apm/celery.py
--- a/src/scout_apm/celery.py
+++ b/src/scout_apm/celery.py
@@ -56,12 +56,13 @@ def task_prerun_callback(task=None, **kwargs):
     if parent_task_id:
         tracked_request.tag("parent_task_id", parent_task_id)
 
-    delivery_info = task.request.delivery_info
-    tracked_request.tag("is_eager", delivery_info.get("is_eager", False))
-    tracked_request.tag("exchange", delivery_info.get("exchange", "unknown"))
-    tracked_request.tag("priority", delivery_info.get("priority", "unknown"))
-    tracked_request.tag("routing_key", delivery_info.get("routing_key", "unknown"))
-    tracked_request.tag("queue", delivery_info.get("queue", "unknown"))
+    delivery_info = getattr(task.request, "delivery_info", None)
+    if delivery_info:
+        tracked_request.tag("is_eager", delivery_info.get("is_eager", False))
+        tracked_request.tag("exchange", delivery_info.get("exchange", "unknown"))
+        tracked_request.tag("priority", delivery_info.get("priority", "unknown"))
+        tracked_request.tag("routing_key", delivery_info.get("routing_key", "unknown"))
+        tracked_request.tag("queue", delivery_info.get("queue", "unknown"))
 
     tracked_request.start_span(operation=("Job/" + task.name))
 


Test patch:
Repository: scoutapp/scout_apm_python

Issue:
new vertion 2.26 No module named 'elasticsearch' 
after updating to scout-apm to 2.26

we got ModuleNotFoundError: No module named 'elasticsearch'

should be easy to fix ,, good luck ^_^


Discussion:
Thanks for the report @MrSalman333. Can you share the full stacktrace?
Never mind, found it.

Resolving patch:
diff --git a/src/scout_apm/instruments/elasticsearch.py b/src/scout_apm/instruments/elasticsearch.py
--- a/src/scout_apm/instruments/elasticsearch.py
+++ b/src/scout_apm/instruments/elasticsearch.py
@@ -4,16 +4,17 @@
 import logging
 from collections import namedtuple
 
-import elasticsearch
 import wrapt
 
 from scout_apm.compat import get_pos_args, unwrap_decorators
 from scout_apm.core.tracked_request import TrackedRequest
 
 try:
+    from elasticsearch import VERSION as ELASTICSEARCH_VERSION
     from elasticsearch import Elasticsearch
 except ImportError:  # pragma: no cover
     Elasticsearch = None
+    ELASTICSEARCH_VERSION = (0, 0, 0)
 
 try:
     # Transport was moved to elastic_transport as of v8.0.0
@@ -100,7 +101,7 @@ def ensure_installed():
 }
 
 CLIENT_METHODS = VERSIONED_CLIENT_METHODS["v7"][:]
-if elasticsearch.VERSION > (8, 0, 0):
+if ELASTICSEARCH_VERSION > (8, 0, 0):
     CLIENT_METHODS += VERSIONED_CLIENT_METHODS["v8"]
 
 


Test patch:
Repository: scoutapp/scout_apm_python

Issue:
Deprecation notice about urllib3[secure]
 ### Description

 pyOpenSSL and urllib3[secure] are deprecated in the upcoming release (1.26.12)
 https://github.com/urllib3/urllib3/issues/2680
 Removed 'urllib3[secure] < 1.25 ; python_version < "3.5"' and  'urllib3[secure] < 2 ; python_version >= "3.5"'

Closes #746


Discussion:

Resolving patch:
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -66,7 +66,7 @@
         'importlib-metadata ; python_version < "3.8"',
         "psutil>=5,<6",
         'urllib3[secure] < 1.25 ; python_version < "3.5"',
-        'urllib3[secure] < 2 ; python_version >= "3.5"',
+        'urllib3 < 2 ; python_version >= "3.5"',
         "wrapt>=1.10,<2.0",
     ],
     keywords=["apm", "performance monitoring", "development"],


Test patch:
Repository: azavea/raster-vision

Issue:
Support prediction_scenes
In addition to `train_scenes` and `test_scenes` in the workflow config, we should add support for`prediction_scenes` which are scenes that you don't have ground truth labels for, but that you want to run predictions on as part of the workflow.


Discussion:

Resolving patch:
diff --git a/src/rastervision/utils/chain_workflow.py b/src/rastervision/utils/chain_workflow.py
--- a/src/rastervision/utils/chain_workflow.py
+++ b/src/rastervision/utils/chain_workflow.py
@@ -16,10 +16,6 @@
     LabelStore as LabelStoreConfig,
     ObjectDetectionGeoJSONFile as ObjectDetectionGeoJSONFileConfig,
     ClassificationGeoJSONFile as ClassificationGeoJSONFileConfig)
-from rastervision.protos.raster_transformer_pb2 import (
-    RasterTransformer as RasterTransformerConfig)
-from rastervision.protos.raster_source_pb2 import (
-    RasterSource as RasterSourceConfig)
 
 from rastervision.utils.files import (
     load_json_config, save_json_config, file_to_str, str_to_file)
@@ -142,6 +138,16 @@ def update_scenes(self):
             scene.prediction_label_store.MergeFrom(
                 self.make_prediction_label_store(scene))
 
+        for idx, scene in enumerate(self.workflow.predict_scenes):
+            if len(scene.id) < 1:
+                scene.id = 'predict-{}'.format(idx)
+            scene.raster_source.raster_transformer.MergeFrom(
+                self.workflow.raster_transformer)
+
+            # Set prediction_label_store from generated URI.
+            scene.prediction_label_store.MergeFrom(
+                self.make_prediction_label_store(scene))
+
     def make_prediction_label_store(self, scene):
         label_store = scene.ground_truth_label_store
         label_store_type = label_store.WhichOneof(
@@ -167,6 +173,7 @@ def get_compute_raster_stats_config(self):
         config = ComputeRasterStatsConfig()
         scenes = copy.deepcopy(self.workflow.train_scenes)
         scenes.extend(self.workflow.test_scenes)
+        scenes.extend(self.workflow.predict_scenes)
         for scene in scenes:
             # Set the raster_transformer so its fields are null since
             # compute_raster_stats will generate stats_uri.
@@ -218,6 +225,7 @@ def get_predict_config(self):
         config = PredictConfig()
         config.machine_learning.MergeFrom(self.workflow.machine_learning)
         config.scenes.MergeFrom(self.workflow.test_scenes)
+        config.scenes.MergeFrom(self.workflow.predict_scenes)
         config.options.MergeFrom(self.workflow.predict_options)
         config.options.debug = self.workflow.debug
         config.options.debug_uri = join(


Test patch:
Repository: azavea/raster-vision

Issue:
Remove dependence on AWS
This PR makes it so that AWS isn't needed to run RV locally. Previously, if `AWS_PROFILE` was blank, it would cause an error when hitting a line that created an S3 client object. If you want to forward AWS credentials (the original behavior), you'll now need to run `./scripts/run --aws`.

Closes #279 


Discussion:

Resolving patch:
diff --git a/src/rastervision/utils/files.py b/src/rastervision/utils/files.py
--- a/src/rastervision/utils/files.py
+++ b/src/rastervision/utils/files.py
@@ -12,7 +12,6 @@
 import botocore
 from google.protobuf import json_format
 
-s3 = boto3.client('s3')
 
 class NotFoundException(Exception):
     pass
@@ -84,6 +83,7 @@ def download_if_needed(uri, download_dir, must_exist=True):
 
         try:
             print('Downloading {} to {}'.format(uri, path))
+            s3 = boto3.client('s3')
             s3.download_file(parsed_uri.netloc, parsed_uri.path[1:], path)
         except botocore.exceptions.ClientError:
             if must_exist:
@@ -100,6 +100,7 @@ def file_to_str(file_uri):
     parsed_uri = urlparse(file_uri)
     if parsed_uri.scheme == 's3':
         with io.BytesIO() as file_buffer:
+            s3 = boto3.client('s3')
             s3.download_fileobj(
                 parsed_uri.netloc, parsed_uri.path[1:], file_buffer)
             return file_buffer.getvalue().decode('utf-8')
@@ -114,6 +115,7 @@ def str_to_file(content_str, file_uri):
         bucket = parsed_uri.netloc
         key = parsed_uri.path[1:]
         with io.BytesIO(bytes(content_str, encoding='utf-8')) as str_buffer:
+            s3 = boto3.client('s3')
             s3.upload_fileobj(str_buffer, bucket, key)
     else:
         make_dir(file_uri, use_dirname=True)
@@ -143,6 +145,7 @@ def upload_if_needed(src_path, dst_uri):
         # Strip the leading slash off of the path since S3 does not expect it.
         print('Uploading {} to {}'.format(src_path, dst_uri))
         if os.path.isfile(src_path):
+            s3 = boto3.client('s3')
             s3.upload_file(
                 src_path, parsed_uri.netloc, parsed_uri.path[1:])
         else:


Test patch:
Repository: azavea/raster-vision

Issue:
Installing Nvidia drivers doesn't work
When building the AMI, the `install-nvidia-drivers.sh` fails with base AMI `'ami-9109beee` (latest deep learning ami) and Nvidia drivers 384.125. I was able to get it to run with the `--install-libglvnd` flag. But, when I start an instance with the resulting AMI, running `nvidia-smi` reports that the drivers aren't installed. At the moment, the latest base AMI has the Nvidia drivers we need, so I've commented out installing them, but in the future we may need this.


Discussion:

Resolving patch:
diff --git a/deployment/packer/driver.py b/deployment/packer/driver.py
--- a/deployment/packer/driver.py
+++ b/deployment/packer/driver.py
@@ -22,7 +22,7 @@ def get_recent_batch_ami(aws_profile):
     sess = boto3.Session(profile_name=aws_profile)
     ec2 = sess.client("ec2")
     images = filter(
-        lambda x: re.search("Deep Learning AMI Amazon Linux .*", x['Name']),
+        lambda x: re.search("Deep Learning Base AMI \(Amazon Linux\) (.*)", x['Name']),
         ec2.describe_images(Filters=filters)['Images'])
     images.sort(key=lambda x: x["CreationDate"])
 


Test patch:
Repository: azavea/raster-vision

Issue:
Fill out model-defaults for tensorflow-od
Currently we only have 1 model in model_defaults.json: 

https://github.com/azavea/raster-vision/blob/feature/api-refactor/src/rastervision/backend/model_defaults.json#L2

We need to fill it out to include each of these configurations, matched up with each of the pretrained weights from the model zoo:

#### Configs
https://github.com/azavea/models/tree/master/research/object_detection/samples/configs

#### Weights
https://github.com/azavea/models/blob/master/research/object_detection/g3doc/detection_model_zoo.md


Discussion:

Resolving patch:
diff --git a/src/rastervision/backend/api.py b/src/rastervision/backend/api.py
--- a/src/rastervision/backend/api.py
+++ b/src/rastervision/backend/api.py
@@ -13,6 +13,20 @@
 
 ### TF Object Detection
 SSD_MOBILENET_V1_COCO = 'SSD_MOBILENET_V1_COCO'
+SSD_MOBILENET_V2_COCO = 'SSD_MOBILENET_V2_COCO'
+SSDLITE_MOBILENET_V2_COCO = 'SSDLITE_MOBILENET_V2_COCO'
+SSD_INCEPTION_V2_COCO = 'SSD_INCEPTION_V2_COCO'
+FASTER_RCNN_INCEPTION_V2_COCO = 'FASTER_RCNN_INCEPTION_V2_COCO'
+FASTER_RCNN_RESNET50_COCO = 'FASTER_RCNN_RESNET50_COCO'
+RFCN_RESNET101_COCO = 'RFCN_RESNET101_COCO'
+FASTER_RCNN_RESNET101_COCO = 'FASTER_RCNN_RESNET101_COCO'
+FASTER_RCNN_INCEPTION_RESNET_V2_ATROUS_COCO = \
+'FASTER_RCNN_INCEPTION_RESNET_V2_ATROUS_COCO'
+MASK_RCNN_INCEPTION_RESNET_V2_ATROUS_COCO = \
+'MASK_RCNN_INCEPTION_RESNET_V2_ATROUS_COCO'
+MASK_RCNN_INCEPTION_V2_COCO = 'MASK_RCNN_INCEPTION_V2_COCO'
+MASK_RCNN_RESNET101_ATROUS_COCO = 'MASK_RCNN_RESNET101_ATROUS_COCO'
+MASK_RCNN_RESNET50_ATROUS_COCO = 'MASK_RCNN_RESNET50_ATROUS_COCO'
 
 ## Keras Classificaiton
 RESNET50_IMAGENET = 'RESNET50_IMAGENET'


Test patch:
Repository: azavea/raster-vision

Issue:
Move to using master in azavea/models
We've been using  a branch of azavea/models, which can cause confusion.

Before release, merge  the `upgrade-sept-2018` branch into the main branch and update our install_deps script accordingly.


Discussion:

Resolving patch:
diff --git a/rastervision/runner/command_dag.py b/rastervision/runner/command_dag.py
--- a/rastervision/runner/command_dag.py
+++ b/rastervision/runner/command_dag.py
@@ -45,7 +45,7 @@ def __init__(self,
 
             with click.progressbar(
                     unsolved_sources,
-                    label='Ensuring input files exists ') as uris:
+                    label='Ensuring input files exist  ') as uris:
                 for uri in uris:
                     if not file_exists(uri):
                         missing_files.append(uri)


Test patch:
Repository: azavea/raster-vision

Issue:
Avoid error when working with subtypes for SemanticSegmentationRasterSource
Here: https://github.com/azavea/raster-vision/blob/f6ea64a37fd4d09375da1838cd679e6cbce5b35b/rastervision/data/label_source/semantic_segmentation_raster_source_config.py#L123

We check for the type explicitly. We should use `isinstance` instead to allow for subclasses to pass this check - or figure out a more general way of not having other types and allowing them to bypass having to set the rgb class map.


Discussion:

Resolving patch:
diff --git a/rastervision/data/label_source/semantic_segmentation_raster_source_config.py b/rastervision/data/label_source/semantic_segmentation_raster_source_config.py
--- a/rastervision/data/label_source/semantic_segmentation_raster_source_config.py
+++ b/rastervision/data/label_source/semantic_segmentation_raster_source_config.py
@@ -6,7 +6,7 @@
                                             LabelSourceConfigBuilder,
                                             SemanticSegmentationRasterSource)
 from rastervision.protos.label_source_pb2 import LabelSourceConfig as LabelSourceConfigMsg
-from rastervision.data.raster_source import RasterSourceConfig, GeoJSONSourceConfig
+from rastervision.data.raster_source import RasterSourceConfig
 
 
 class SemanticSegmentationRasterSourceConfig(LabelSourceConfig):
@@ -113,15 +113,8 @@ def with_rgb_class_map(self, rgb_class_map):
 
     def validate(self):
         source = self.config.get('source')
-        rgb_class_map = self.config.get('rgb_class_map')
 
         if source is None:
             raise rv.ConfigError(
                 'You must set the source for SemanticSegmentationRasterSourceConfig'
                 ' Use "with_raster_source".')
-
-        if type(source) != GeoJSONSourceConfig and rgb_class_map is None:
-            raise rv.ConfigError(
-                'You must set the rgb_class_map for '
-                'SemanticSegmentationRasterSourceConfig. Use "with_rgb_class_map".'
-            )


Test patch:
Repository: azavea/raster-vision

Issue:
Add Changelog
We need a changelog in the docs that we can update for every PR that adds a fix or a feature.


Discussion:

Resolving patch:
diff --git a/docs/conf.py b/docs/conf.py
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -92,6 +92,7 @@
         ProjectLink('QGIS Plugin', 'https://github.com/azavea/raster-vision-qgis'),
         ProjectLink('AWS Batch Setup', 'https://github.com/azavea/raster-vision-aws'),
         ProjectLink('Issue Tracker', 'https://github.com/azavea/raster-vision/issues/'),
+        ProjectLink('CHANGELOG', 'changelog.html'),
         ProjectLink('Azavea', 'https://www.azavea.com/'),
     ],
     'css_files': [


Test patch:
Repository: azavea/raster-vision

Issue:
Ctrl-c does not kill child commands
It's a little hard to replicate this, but sometimes when running commands with the local runner, hitting ctrl-c kills the process, but not the child commands which were created by shelling out. I'm pretty sure this is due to the changes we just made to the command runner. We need to do the same thing we do in the backends when shelling out to avoid this.


Discussion:
> We need to do the same thing we do in the backends when shelling out to avoid this.

This is what I was referring to https://github.com/azavea/raster-vision/blob/develop/rastervision/backend/tf_deeplab.py#L609-L611

Resolving patch:
diff --git a/rastervision/backend/tf_deeplab.py b/rastervision/backend/tf_deeplab.py
--- a/rastervision/backend/tf_deeplab.py
+++ b/rastervision/backend/tf_deeplab.py
@@ -18,14 +18,15 @@
 from rastervision.data.scene import Scene
 from rastervision.data.label import SemanticSegmentationLabels
 from rastervision.core.training_data import TrainingData
-from rastervision.backend.tf_object_detection import (
-    write_tf_record, terminate_at_exit, TRAIN, VALIDATION)
+from rastervision.backend.tf_object_detection import (write_tf_record, TRAIN,
+                                                      VALIDATION)
 from rastervision.protos.deeplab.train_pb2 import (TrainingParameters as
                                                    TrainingParametersMsg)
 from rastervision.utils.files import (download_if_needed, get_local_path,
                                       make_dir, start_sync, upload_or_copy,
                                       sync_to_dir, sync_from_dir)
-from rastervision.utils.misc import (numpy_to_png, png_to_numpy, save_img)
+from rastervision.utils.misc import (numpy_to_png, png_to_numpy, save_img,
+                                     terminate_at_exit)
 from rastervision.data.label_source.utils import color_to_integer
 from rastervision.rv_config import RVConfig
 
diff --git a/rastervision/runner/local_experiment_runner.py b/rastervision/runner/local_experiment_runner.py
--- a/rastervision/runner/local_experiment_runner.py
+++ b/rastervision/runner/local_experiment_runner.py
@@ -1,8 +1,9 @@
-import subprocess
+from subprocess import Popen
 import sys
 import logging
 
 from rastervision.runner import OutOfProcessExperimentRunner
+from rastervision.utils.misc import (terminate_at_exit)
 
 log = logging.getLogger(__name__)
 
@@ -21,7 +22,10 @@ def shellout(self,
                  command,
                  parent_job_ids=None,
                  array_size=None):
-        exitcode = subprocess.call(command, shell=True)
+        command = list(filter(lambda s: len(s) > 0, command.split(' ')))
+        process = Popen(command)
+        terminate_at_exit(process)
+        exitcode = process.wait()
         if exitcode != 0:
             sys.exit(exitcode)
         else:


Test patch:
Repository: azavea/raster-vision

Issue:
Update setup.rst to reference raster-vision-cloudformation
The setup instructions currently reference raster-vision-aws.


Discussion:

Resolving patch:
diff --git a/docs/conf.py b/docs/conf.py
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -91,7 +91,7 @@
         ProjectLink('Gitter Channel', 'https://gitter.im/azavea/raster-vision'),
         ProjectLink('Raster Vision Examples', 'https://github.com/azavea/raster-vision-examples'),
         ProjectLink('QGIS Plugin', 'https://github.com/azavea/raster-vision-qgis'),
-        ProjectLink('AWS Batch Setup', 'https://github.com/azavea/raster-vision-aws'),
+        ProjectLink('AWS Batch Setup', 'https://github.com/azavea/raster-vision-cloudformation'),
         ProjectLink('Issue Tracker', 'https://github.com/azavea/raster-vision/issues/'),
         ProjectLink('CHANGELOG', 'changelog.html'),
         ProjectLink('Azavea', 'https://www.azavea.com/'),


Test patch:
Repository: azavea/raster-vision

Issue:
Avoid downloading all rasters
If you have many large scenes, the rasters will all be downloaded at once and you will run out of disk space. This is because the download occurs in the constructor of `RasterSources`. Instead, dwe should download rasters https://github.com/azavea/raster-vision/blob/develop/rastervision/data/raster_source/rasterio_source.py#L79 in the _activate method https://github.com/azavea/raster-vision/blob/develop/rastervision/data/raster_source/rasterio_source.py#L100 and delete them in the _deactivate method. 


Discussion:

Resolving patch:
diff --git a/rastervision/command/command.py b/rastervision/command/command.py
--- a/rastervision/command/command.py
+++ b/rastervision/command/command.py
@@ -19,7 +19,9 @@ def get_tmp_dir(self):
             else:
                 return self._tmp_dir.name
         else:
-            return RVConfig.get_tmp_dir().name
+            tmp_dir = RVConfig.get_tmp_dir()
+            self.set_tmp_dir(tmp_dir)
+            return tmp_dir.name
 
 
 class NoOpCommand(Command):
diff --git a/rastervision/data/raster_source/image_source.py b/rastervision/data/raster_source/image_source.py
--- a/rastervision/data/raster_source/image_source.py
+++ b/rastervision/data/raster_source/image_source.py
@@ -11,7 +11,7 @@ def __init__(self, uri, raster_transformers, temp_dir, channel_order=None):
         super().__init__(raster_transformers, temp_dir, channel_order)
 
     def _download_data(self, temp_dir):
-        return download_if_needed(self.uri, self.temp_dir)
+        return download_if_needed(self.uri, temp_dir)
 
     def _set_crs_transformer(self):
         self.crs_transformer = IdentityCRSTransformer()
diff --git a/rastervision/data/raster_source/rasterio_source.py b/rastervision/data/raster_source/rasterio_source.py
--- a/rastervision/data/raster_source/rasterio_source.py
+++ b/rastervision/data/raster_source/rasterio_source.py
@@ -1,4 +1,5 @@
 from abc import abstractmethod
+import tempfile
 
 import numpy as np
 import rasterio
@@ -38,8 +39,8 @@ def load_window(image_dataset, window=None, channels=None, is_masked=False):
 class RasterioRasterSource(ActivateMixin, RasterSource):
     def __init__(self, raster_transformers, temp_dir, channel_order=None):
         self.temp_dir = temp_dir
-        self.imagery_path = self._download_data(temp_dir)
-
+        self.image_temp_dir = None
+        self.image_dataset = None
         num_channels = None
 
         # Activate in order to get information out of the raster
@@ -98,8 +99,14 @@ def _get_chip(self, window):
                            self.channels)
 
     def _activate(self):
+        # Download images to temporary directory and delete it when done.
+        self.image_temp_dir = tempfile.TemporaryDirectory(dir=self.temp_dir)
+        self.imagery_path = self._download_data(self.image_temp_dir.name)
         self.image_dataset = rasterio.open(self.imagery_path)
+        self._set_crs_transformer()
 
     def _deactivate(self):
         self.image_dataset.close()
         self.image_dataset = None
+        self.image_temp_dir.cleanup()
+        self.image_temp_dir = None


Test patch:
Repository: azavea/raster-vision

Issue:
Predict zero for nodata pixels on semantic segmentation



Discussion:

Resolving patch:
diff --git a/rastervision/task/semantic_segmentation.py b/rastervision/task/semantic_segmentation.py
--- a/rastervision/task/semantic_segmentation.py
+++ b/rastervision/task/semantic_segmentation.py
@@ -126,12 +126,12 @@ def predict_scene(self, scene, tmp_dir):
 
         def label_fn(window):
             chip = raster_source.get_chip(window)
-            if np.any(chip):
-                chip = raster_source.get_chip(window)
-                labels = self.backend.predict([chip], [window], tmp_dir)
-                label_arr = labels.get_label_arr(window)
-            else:
-                label_arr = np.zeros((window.get_height(), window.get_width()))
+            labels = self.backend.predict([chip], [window], tmp_dir)
+            label_arr = labels.get_label_arr(window)
+
+            # Set NODATA pixels in imagery to predicted value of 0 (ie. ignore)
+            label_arr[np.sum(chip, axis=2) == 0] = 0
+
             print('.', end='', flush=True)
             return label_arr
 


Test patch: