We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Rasterization Impossible for (At Least Some) `class_id_to_filter` Arguments
A setup like this:
```python
    class_id_filter_dict = {
        0: ['==', 'default', 'Background'],
        1: ['==', 'default', 'Cloud'],
    }

    label_source = SemanticSegmentationLabelSourceConfig(
        raster_source=RasterizedSourceConfig(
            vector_source=GeoJSONVectorSourceConfig(
                uri=hrefs[1],
                class_id_to_filter=class_id_filter_dict,
                default_class_id=0),
            rasterizer_config=RasterizerConfig(background_class_id=0)
        ))
```

produces this error
```
Traceback (most recent call last):                                                                                                                                                                                   
  File "/opt/conda/lib/python3.6/runpy.py", line 193, in _run_module_as_main                                                                                                                                         
    "__main__", mod_spec)                                                                                                                                                                                            
  File "/opt/conda/lib/python3.6/runpy.py", line 85, in _run_code                                                                                                                                                    
    exec(code, run_globals)                                                                                                                                                                                          
  File "/opt/src/rastervision_pipeline/rastervision/pipeline/cli.py", line 248, in <module>                                                                                                                          
    main()                                                                                                                                                                                                           
  File "/opt/conda/lib/python3.6/site-packages/click/core.py", line 722, in __call__                                                                                                                                 
    return self.main(*args, **kwargs)                                                                                                                                                                                
  File "/opt/conda/lib/python3.6/site-packages/click/core.py", line 697, in main                                                                                                                                     
    rv = self.invoke(ctx)                                                                                                                                                                                            
  File "/opt/conda/lib/python3.6/site-packages/click/core.py", line 1066, in invoke                                                                                                                                  
    return _process_result(sub_ctx.command.invoke(sub_ctx))                                                                                                                                                          
  File "/opt/conda/lib/python3.6/site-packages/click/core.py", line 895, in invoke                                                                                                                                   
    return ctx.invoke(self.callback, **ctx.params)                                                                                                                                                                   
  File "/opt/conda/lib/python3.6/site-packages/click/core.py", line 535, in invoke                                                                                                                                   
    return callback(*args, **kwargs)                                                                                                                                                                                 
  File "/opt/src/rastervision_pipeline/rastervision/pipeline/cli.py", line 240, in run_command                                                                                                                       
    runner=runner)
  File "/opt/src/rastervision_pipeline/rastervision/pipeline/cli.py", line 217, in _run_command                                                                                                             [94/1935]
    command_fn()                                                                                                                                                                                                     
  File "/opt/src/rastervision_core/rastervision/core/rv_pipeline/rv_pipeline.py", line 107, in chip                                                                                                                  
    chip_scene(s.build(class_cfg, self.tmp_dir), TRAIN)                                                                                                                                                              
  File "/opt/src/rastervision_core/rastervision/core/rv_pipeline/rv_pipeline.py", line 96, in chip_scene                                                                                                             
    labels = self.get_train_labels(window, scene)                                                                                                                                                                    
  File "/opt/src/rastervision_core/rastervision/core/rv_pipeline/semantic_segmentation.py", line 112, in get_train_labels                                                                                            
    return scene.ground_truth_label_source.get_labels(window=window)                                                                                                                                                 
  File "/opt/src/rastervision_core/rastervision/core/data/label_source/semantic_segmentation_label_source.py", line 98, in get_labels                                                                                
    raw_labels = self.raster_source.get_raw_chip(window)                                                                                                                                                             
  File "/opt/src/rastervision_core/rastervision/core/data/raster_source/raster_source.py", line 101, in get_raw_chip                                                                                                 
    return self._get_chip(window)                                                                                                                                                                                    
  File "/opt/src/rastervision_core/rastervision/core/data/raster_source/rasterized_source.py", line 107, in _get_chip                                                                                                
    self.get_extent())                                                                                                                                                                                               
  File "/opt/src/rastervision_core/rastervision/core/data/raster_source/rasterized_source.py", line 44, in geoms_to_raster
    all_touched=all_touched)                                                    
  File "/opt/conda/lib/python3.6/site-packages/rasterio/env.py", line 366, in wrapper
    return f(*args, **kwds)                                                        
  File "/opt/conda/lib/python3.6/site-packages/rasterio/features.py", line 280, in rasterize                                                  
    if not validate_dtype(shape_values, valid_dtypes):                                                                                                   
  File "/opt/conda/lib/python3.6/site-packages/rasterio/dtypes.py", line 184, in validate_dtype
    get_minimum_dtype(values) in valid_dtypes)                                    
  File "/opt/conda/lib/python3.6/site-packages/rasterio/dtypes.py", line 107, in get_minimum_dtype
    min_value = values.min()                                                          
  File "/opt/conda/lib/python3.6/site-packages/numpy/core/_methods.py", line 32, in _amin
    return umr_minimum(a, axis, None, out, keepdims, initial)                                
TypeError: cannot perform reduce with flexible type
```
which is evidently due to the `class_id`s being strings rather than integers.


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `rastervision_core/rastervision/core/data/vector_source/class_inference.py`
Content:
```
1 import copy
2 
3 from rastervision.core.data.vector_source.label_maker.filter import (
4     create_filter)
5 
6 
7 class ClassInference():
8     """Infers missing class_ids from GeoJSON features."""
9 
10     def __init__(self,
11                  default_class_id,
12                  class_config=None,
13                  class_id_to_filter=None):
14         self.class_config = class_config
15         self.class_id_to_filter = class_id_to_filter
16         self.default_class_id = default_class_id
17 
18         if self.class_id_to_filter is not None:
19             self.class_id_to_filter = {}
20             for class_id, filter_exp in class_id_to_filter.items():
21                 self.class_id_to_filter[class_id] = create_filter(filter_exp)
22 
23     def infer_class_id(self, feature):
24         """Infer the class_id for a GeoJSON feature.
25 
26         Args:
27             feature: (dict) GeoJSON feature
28 
29         Rules:
30             1) If class_id is in feature['properties'], use it.
31             2) If class_name or label are in feature['properties'] and in class_config,
32                 use corresponding class_id.
33             3) If class_id_to_filter is set and filter is true when applied to feature,
34                 use corresponding class_id.
35             4) Otherwise, return the default_class_id
36         """
37         class_id = feature.get('properties', {}).get('class_id')
38         if class_id is not None:
39             return class_id
40 
41         if self.class_config is not None:
42             class_name = feature.get('properties', {}).get('class_name')
43             if class_name in self.class_config.names:
44                 return self.class_config.names.index(class_name)
45 
46             label = feature.get('properties', {}).get('label')
47             if label in self.class_config.names:
48                 return self.class_config.names.index(label)
49 
50         if self.class_id_to_filter is not None:
51             for class_id, filter_fn in self.class_id_to_filter.items():
52                 if filter_fn(feature):
53                     return class_id
54 
55         return self.default_class_id
56 
57     def transform_geojson(self, geojson):
58         """Transform GeoJSON by appending class_ids and removing features with no class.
59 
60         For each feature in geojson, the class_id is inferred and is set into
61         feature['properties']. If the class_id is None (because none of the rules apply
62         and the default_class_id is None), the feature is dropped.
63         """
64         new_features = []
65         for feature in geojson['features']:
66             class_id = self.infer_class_id(feature)
67             if class_id is not None:
68                 feature = copy.deepcopy(feature)
69                 properties = feature.get('properties', {})
70                 properties['class_id'] = class_id
71                 feature['properties'] = properties
72                 new_features.append(feature)
73         new_geojson = {'type': 'FeatureCollection', 'features': new_features}
74         return new_geojson
75
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/rastervision_core/rastervision/core/data/vector_source/class_inference.py b/rastervision_core/rastervision/core/data/vector_source/class_inference.py
--- a/rastervision_core/rastervision/core/data/vector_source/class_inference.py
+++ b/rastervision_core/rastervision/core/data/vector_source/class_inference.py
@@ -18,7 +18,8 @@
         if self.class_id_to_filter is not None:
             self.class_id_to_filter = {}
             for class_id, filter_exp in class_id_to_filter.items():
-                self.class_id_to_filter[class_id] = create_filter(filter_exp)
+                self.class_id_to_filter[int(class_id)] = create_filter(
+                    filter_exp)
 
     def infer_class_id(self, feature):
         """Infer the class_id for a GeoJSON feature.

{"golden_diff": "diff --git a/rastervision_core/rastervision/core/data/vector_source/class_inference.py b/rastervision_core/rastervision/core/data/vector_source/class_inference.py\n--- a/rastervision_core/rastervision/core/data/vector_source/class_inference.py\n+++ b/rastervision_core/rastervision/core/data/vector_source/class_inference.py\n@@ -18,7 +18,8 @@\n         if self.class_id_to_filter is not None:\n             self.class_id_to_filter = {}\n             for class_id, filter_exp in class_id_to_filter.items():\n-                self.class_id_to_filter[class_id] = create_filter(filter_exp)\n+                self.class_id_to_filter[int(class_id)] = create_filter(\n+                    filter_exp)\n \n     def infer_class_id(self, feature):\n         \"\"\"Infer the class_id for a GeoJSON feature.\n", "issue": "Rasterization Impossible for (At Least Some) `class_id_to_filter` Arguments\nA setup like this:\r\n```python\r\n    class_id_filter_dict = {\r\n        0: ['==', 'default', 'Background'],\r\n        1: ['==', 'default', 'Cloud'],\r\n    }\r\n\r\n    label_source = SemanticSegmentationLabelSourceConfig(\r\n        raster_source=RasterizedSourceConfig(\r\n            vector_source=GeoJSONVectorSourceConfig(\r\n                uri=hrefs[1],\r\n                class_id_to_filter=class_id_filter_dict,\r\n                default_class_id=0),\r\n            rasterizer_config=RasterizerConfig(background_class_id=0)\r\n        ))\r\n```\r\n\r\nproduces this error\r\n```\r\nTraceback (most recent call last):                                                                                                                                                                                   \r\n  File \"/opt/conda/lib/python3.6/runpy.py\", line 193, in _run_module_as_main                                                                                                                                         \r\n    \"__main__\", mod_spec)                                                                                                                                                                                            \r\n  File \"/opt/conda/lib/python3.6/runpy.py\", line 85, in _run_code                                                                                                                                                    \r\n    exec(code, run_globals)                                                                                                                                                                                          \r\n  File \"/opt/src/rastervision_pipeline/rastervision/pipeline/cli.py\", line 248, in <module>                                                                                                                          \r\n    main()                                                                                                                                                                                                           \r\n  File \"/opt/conda/lib/python3.6/site-packages/click/core.py\", line 722, in __call__                                                                                                                                 \r\n    return self.main(*args, **kwargs)                                                                                                                                                                                \r\n  File \"/opt/conda/lib/python3.6/site-packages/click/core.py\", line 697, in main                                                                                                                                     \r\n    rv = self.invoke(ctx)                                                                                                                                                                                            \r\n  File \"/opt/conda/lib/python3.6/site-packages/click/core.py\", line 1066, in invoke                                                                                                                                  \r\n    return _process_result(sub_ctx.command.invoke(sub_ctx))                                                                                                                                                          \r\n  File \"/opt/conda/lib/python3.6/site-packages/click/core.py\", line 895, in invoke                                                                                                                                   \r\n    return ctx.invoke(self.callback, **ctx.params)                                                                                                                                                                   \r\n  File \"/opt/conda/lib/python3.6/site-packages/click/core.py\", line 535, in invoke                                                                                                                                   \r\n    return callback(*args, **kwargs)                                                                                                                                                                                 \r\n  File \"/opt/src/rastervision_pipeline/rastervision/pipeline/cli.py\", line 240, in run_command                                                                                                                       \r\n    runner=runner)\r\n  File \"/opt/src/rastervision_pipeline/rastervision/pipeline/cli.py\", line 217, in _run_command                                                                                                             [94/1935]\r\n    command_fn()                                                                                                                                                                                                     \r\n  File \"/opt/src/rastervision_core/rastervision/core/rv_pipeline/rv_pipeline.py\", line 107, in chip                                                                                                                  \r\n    chip_scene(s.build(class_cfg, self.tmp_dir), TRAIN)                                                                                                                                                              \r\n  File \"/opt/src/rastervision_core/rastervision/core/rv_pipeline/rv_pipeline.py\", line 96, in chip_scene                                                                                                             \r\n    labels = self.get_train_labels(window, scene)                                                                                                                                                                    \r\n  File \"/opt/src/rastervision_core/rastervision/core/rv_pipeline/semantic_segmentation.py\", line 112, in get_train_labels                                                                                            \r\n    return scene.ground_truth_label_source.get_labels(window=window)                                                                                                                                                 \r\n  File \"/opt/src/rastervision_core/rastervision/core/data/label_source/semantic_segmentation_label_source.py\", line 98, in get_labels                                                                                \r\n    raw_labels = self.raster_source.get_raw_chip(window)                                                                                                                                                             \r\n  File \"/opt/src/rastervision_core/rastervision/core/data/raster_source/raster_source.py\", line 101, in get_raw_chip                                                                                                 \r\n    return self._get_chip(window)                                                                                                                                                                                    \r\n  File \"/opt/src/rastervision_core/rastervision/core/data/raster_source/rasterized_source.py\", line 107, in _get_chip                                                                                                \r\n    self.get_extent())                                                                                                                                                                                               \r\n  File \"/opt/src/rastervision_core/rastervision/core/data/raster_source/rasterized_source.py\", line 44, in geoms_to_raster\r\n    all_touched=all_touched)                                                    \r\n  File \"/opt/conda/lib/python3.6/site-packages/rasterio/env.py\", line 366, in wrapper\r\n    return f(*args, **kwds)                                                        \r\n  File \"/opt/conda/lib/python3.6/site-packages/rasterio/features.py\", line 280, in rasterize                                                  \r\n    if not validate_dtype(shape_values, valid_dtypes):                                                                                                   \r\n  File \"/opt/conda/lib/python3.6/site-packages/rasterio/dtypes.py\", line 184, in validate_dtype\r\n    get_minimum_dtype(values) in valid_dtypes)                                    \r\n  File \"/opt/conda/lib/python3.6/site-packages/rasterio/dtypes.py\", line 107, in get_minimum_dtype\r\n    min_value = values.min()                                                          \r\n  File \"/opt/conda/lib/python3.6/site-packages/numpy/core/_methods.py\", line 32, in _amin\r\n    return umr_minimum(a, axis, None, out, keepdims, initial)                                \r\nTypeError: cannot perform reduce with flexible type\r\n```\r\nwhich is evidently due to the `class_id`s being strings rather than integers.\r\n\n", "before_files": [{"content": "import copy\n\nfrom rastervision.core.data.vector_source.label_maker.filter import (\n    create_filter)\n\n\nclass ClassInference():\n    \"\"\"Infers missing class_ids from GeoJSON features.\"\"\"\n\n    def __init__(self,\n                 default_class_id,\n                 class_config=None,\n                 class_id_to_filter=None):\n        self.class_config = class_config\n        self.class_id_to_filter = class_id_to_filter\n        self.default_class_id = default_class_id\n\n        if self.class_id_to_filter is not None:\n            self.class_id_to_filter = {}\n            for class_id, filter_exp in class_id_to_filter.items():\n                self.class_id_to_filter[class_id] = create_filter(filter_exp)\n\n    def infer_class_id(self, feature):\n        \"\"\"Infer the class_id for a GeoJSON feature.\n\n        Args:\n            feature: (dict) GeoJSON feature\n\n        Rules:\n            1) If class_id is in feature['properties'], use it.\n            2) If class_name or label are in feature['properties'] and in class_config,\n                use corresponding class_id.\n            3) If class_id_to_filter is set and filter is true when applied to feature,\n                use corresponding class_id.\n            4) Otherwise, return the default_class_id\n        \"\"\"\n        class_id = feature.get('properties', {}).get('class_id')\n        if class_id is not None:\n            return class_id\n\n        if self.class_config is not None:\n            class_name = feature.get('properties', {}).get('class_name')\n            if class_name in self.class_config.names:\n                return self.class_config.names.index(class_name)\n\n            label = feature.get('properties', {}).get('label')\n            if label in self.class_config.names:\n                return self.class_config.names.index(label)\n\n        if self.class_id_to_filter is not None:\n            for class_id, filter_fn in self.class_id_to_filter.items():\n                if filter_fn(feature):\n                    return class_id\n\n        return self.default_class_id\n\n    def transform_geojson(self, geojson):\n        \"\"\"Transform GeoJSON by appending class_ids and removing features with no class.\n\n        For each feature in geojson, the class_id is inferred and is set into\n        feature['properties']. If the class_id is None (because none of the rules apply\n        and the default_class_id is None), the feature is dropped.\n        \"\"\"\n        new_features = []\n        for feature in geojson['features']:\n            class_id = self.infer_class_id(feature)\n            if class_id is not None:\n                feature = copy.deepcopy(feature)\n                properties = feature.get('properties', {})\n                properties['class_id'] = class_id\n                feature['properties'] = properties\n                new_features.append(feature)\n        new_geojson = {'type': 'FeatureCollection', 'features': new_features}\n        return new_geojson\n", "path": "rastervision_core/rastervision/core/data/vector_source/class_inference.py"}], "after_files": [{"content": "import copy\n\nfrom rastervision.core.data.vector_source.label_maker.filter import (\n    create_filter)\n\n\nclass ClassInference():\n    \"\"\"Infers missing class_ids from GeoJSON features.\"\"\"\n\n    def __init__(self,\n                 default_class_id,\n                 class_config=None,\n                 class_id_to_filter=None):\n        self.class_config = class_config\n        self.class_id_to_filter = class_id_to_filter\n        self.default_class_id = default_class_id\n\n        if self.class_id_to_filter is not None:\n            self.class_id_to_filter = {}\n            for class_id, filter_exp in class_id_to_filter.items():\n                self.class_id_to_filter[int(class_id)] = create_filter(\n                    filter_exp)\n\n    def infer_class_id(self, feature):\n        \"\"\"Infer the class_id for a GeoJSON feature.\n\n        Args:\n            feature: (dict) GeoJSON feature\n\n        Rules:\n            1) If class_id is in feature['properties'], use it.\n            2) If class_name or label are in feature['properties'] and in class_config,\n                use corresponding class_id.\n            3) If class_id_to_filter is set and filter is true when applied to feature,\n                use corresponding class_id.\n            4) Otherwise, return the default_class_id\n        \"\"\"\n        class_id = feature.get('properties', {}).get('class_id')\n        if class_id is not None:\n            return class_id\n\n        if self.class_config is not None:\n            class_name = feature.get('properties', {}).get('class_name')\n            if class_name in self.class_config.names:\n                return self.class_config.names.index(class_name)\n\n            label = feature.get('properties', {}).get('label')\n            if label in self.class_config.names:\n                return self.class_config.names.index(label)\n\n        if self.class_id_to_filter is not None:\n            for class_id, filter_fn in self.class_id_to_filter.items():\n                if filter_fn(feature):\n                    return class_id\n\n        return self.default_class_id\n\n    def transform_geojson(self, geojson):\n        \"\"\"Transform GeoJSON by appending class_ids and removing features with no class.\n\n        For each feature in geojson, the class_id is inferred and is set into\n        feature['properties']. If the class_id is None (because none of the rules apply\n        and the default_class_id is None), the feature is dropped.\n        \"\"\"\n        new_features = []\n        for feature in geojson['features']:\n            class_id = self.infer_class_id(feature)\n            if class_id is not None:\n                feature = copy.deepcopy(feature)\n                properties = feature.get('properties', {})\n                properties['class_id'] = class_id\n                feature['properties'] = properties\n                new_features.append(feature)\n        new_geojson = {'type': 'FeatureCollection', 'features': new_features}\n        return new_geojson\n", "path": "rastervision_core/rastervision/core/data/vector_source/class_inference.py"}]}