Skip to content

Commit

Permalink
Merge pull request #467 from azavea/rde/feature/rename-and-reorg
Browse files Browse the repository at this point in the history
Repository reorganization, renames
  • Loading branch information
lossyrob committed Oct 7, 2018
2 parents 23fbf07 + deda464 commit f33a96d
Show file tree
Hide file tree
Showing 329 changed files with 143 additions and 140 deletions.
2 changes: 1 addition & 1 deletion src/.flake8 → .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ max-line-length = 90
# W503: flake8 reports this as incorrect, and scripts/format_code
# changes code to it, so let format_code win.

ignore = E127,W503
ignore = E127,W503
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ deployment/ansible/*.retry
.#*

# Generated pb2 files
src/rastervision/protos/**/*_pb2.py
rastervision/protos/**/*_pb2.py

# Vim
.*.sw*
Expand Down
4 changes: 2 additions & 2 deletions .travis/build
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ set -e

source .travis/env

docker build -t ${CPU_IMAGE} -f src/Dockerfile-cpu src;
docker build -t ${CPU_IMAGE} -f Dockerfile-cpu .;

if [ "${1}" == "BUILD_ALL" ]; then
docker build -t ${GPU_IMAGE} -f src/Dockerfile-gpu src;
docker build -t ${GPU_IMAGE} -f Dockerfile-gpu .;
fi
4 changes: 2 additions & 2 deletions .travis/codecov
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash

docker run -w $(pwd)/src -v $(pwd):$(pwd) --rm raster-vision-cpu coverage xml
docker run -e CODECOV_TOKEN=$CODECOV_TOKEN -v $(pwd):$(pwd) --rm raster-vision-cpu codecov --root=$(pwd)/src --commit=$TRAVIS_COMMIT
docker run -w $(pwd) -v $(pwd):$(pwd) --rm raster-vision-cpu coverage xml
docker run -e CODECOV_TOKEN=$CODECOV_TOKEN -v $(pwd):$(pwd) --rm raster-vision-cpu codecov --root=$(pwd) --commit=$TRAVIS_COMMIT
8 changes: 4 additions & 4 deletions .travis/test
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

docker run -v $(pwd):$(pwd) --rm -it raster-vision-cpu rm -f $(pwd)/src/.coverage $(pwd)/src/coverage.xml
docker run -v $(pwd):$(pwd) --rm -it raster-vision-cpu rm -f $(pwd)/.coverage $(pwd)/coverage.xml
docker run --rm -it raster-vision-cpu /opt/src/scripts/style_tests && \
docker run -w $(pwd)/src -v $(pwd):$(pwd) --rm -it raster-vision-cpu $(pwd)/src/scripts/compile && \
docker run -w $(pwd)/src -v $(pwd):$(pwd) --rm -it raster-vision-cpu $(pwd)/src/scripts/unit_tests && \
docker run -v $(pwd):$(pwd) --rm -it raster-vision-cpu $(pwd)/src/scripts/integration_tests
docker run -w $(pwd) -v $(pwd):$(pwd) --rm -it raster-vision-cpu $(pwd)/scripts/compile && \
docker run -w $(pwd) -v $(pwd):$(pwd) --rm -it raster-vision-cpu $(pwd)/scripts/unit_tests && \
docker run -v $(pwd):$(pwd) --rm -it raster-vision-cpu $(pwd)/scripts/integration_tests
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions scripts/update → docker/build
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ then

if [ $# -eq 0 -o "${1:-}" = "--cpu" ]
then
docker build -t raster-vision-cpu -f src/Dockerfile-cpu src
docker build -t raster-vision-cpu -f Dockerfile-cpu .
fi
if [ $# -eq 0 -o "${1:-}" = "--gpu" ]
then
docker build -t raster-vision-gpu -f src/Dockerfile-gpu src
docker build -t raster-vision-gpu -f Dockerfile-gpu .
fi
fi
2 changes: 1 addition & 1 deletion scripts/clean → docker/clean
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ if [ "${BASH_SOURCE[0]}" = "${0}" ]; then
if [ "${1:-}" = "--help" ]; then
usage
else
docker images -qf dangling=true | xargs -r docker rmi
docker images -qf dangling=true | xargs docker rmi
fi
fi
5 changes: 2 additions & 3 deletions scripts/run → docker/console
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,11 @@ SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ] ; do SOURCE="$(readlink "$SOURCE")"; done
SCRIPTS_DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
PROJECT_ROOT="$( cd -P "$( dirname "$SCRIPTS_DIR" )" && pwd )"
SRC="${PROJECT_ROOT}/src"

function usage() {
echo -n \
"Usage: $(basename "$0")
Run raster-vision image locally.
Run a console in the raster-vision docker image locally.
--aws forwards AWS credentials.
--tensorboard maps port 6006
--gpu use the NVIDIA runtime and GPU image
Expand Down Expand Up @@ -64,7 +63,7 @@ if [ "${BASH_SOURCE[0]}" = "${0}" ]
then
docker run ${RUNTIME} ${NAME} --rm -it ${TENSORBOARD} ${AWS} \
-v ${HOME}/.rastervision:/root/.rastervision \
-v "$SRC":/opt/src \
-v "$PROJECT_ROOT":/opt/src \
-v ${RASTER_VISION_DATA_DIR}:/opt/data \
${IMAGE} "${@:1}"
fi
5 changes: 2 additions & 3 deletions scripts/jupyter → docker/jupyter
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ] ; do SOURCE="$(readlink "$SOURCE")"; done
SCRIPTS_DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
PROJECT_ROOT="$( cd -P "$( dirname "$SCRIPTS_DIR" )" && pwd )"
SRC="$PROJECT_ROOT/src"

function usage() {
echo -n \
Expand All @@ -25,7 +24,7 @@ then
docker run --rm -it \
-e "AWS_PROFILE=$AWS_PROFILE" \
-v "$HOME/.aws":/root/.aws:ro \
-v "$SRC":/opt/src \
-v "$PROJECT_ROOT":/opt/src \
-v ${RASTER_VISION_DATA_DIR}:/opt/data \
-v ${RASTER_VISION_NOTEBOOK_DIR}:/opt/notebooks \
-p 8888:8888 \
Expand All @@ -40,7 +39,7 @@ then
docker run --rm -it \
-e "AWS_PROFILE=$AWS_PROFILE" \
-v "$HOME/.aws":/root/.aws:ro \
-v "$SRC":/opt/src \
-v "$PROJECT_ROOT":/opt/src \
-v ${RASTER_VISION_DATA_DIR}:/opt/data \
-p 8888:8888 \
raster-vision-cpu \
Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = "sphinx_rtd_theme"
html_theme = 'sphinx_rtd_theme'

# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def load_bundle_files(self, bundle_dir):
.with_stats_uri(local_stats_uri) \
.build()

def preprocess_command(self, command_type, experiment_config, context=[]):
def update_for_command(self, command_type, experiment_config, context=[]):
conf = self
io_def = rv.core.CommandIODefinition()
if command_type == rv.ANALYZE:
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def from_proto(msg):
.from_proto(msg) \
.build()

def preprocess_command(self, command_type, experiment_config, context=[]):
def update_for_command(self, command_type, experiment_config, context=[]):
# Generally augmentors do not have an affect on the IO.
return (self, rv.core.CommandIODefinition())

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def from_proto(msg):
.from_proto(msg) \
.build()

def preprocess_command(self, command_type, experiment_config,
def update_for_command(self, command_type, experiment_config,
context=None):
io_def = CommandIODefinition()
if command_type == rv.TRAIN:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,9 @@ def load_bundle_files(self, bundle_dir):
.with_model_uri(local_model_uri) \
.build()

def preprocess_command(self, command_type, experiment_config,
def update_for_command(self, command_type, experiment_config,
context=None):
conf, io_def = super().preprocess_command(command_type,
conf, io_def = super().update_for_command(command_type,
experiment_config, context)
if command_type == rv.CHIP:
if not conf.training_data_uri:
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,9 @@ def to_proto(self):

return msg

def preprocess_command(self, command_type, experiment_config,
def update_for_command(self, command_type, experiment_config,
context=None):
conf, io_def = super().preprocess_command(command_type,
conf, io_def = super().update_for_command(command_type,
experiment_config, context)
if command_type == rv.CHIP:
conf.training_data_uri = experiment_config.chip_uri
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,9 @@ def load_bundle_files(self, bundle_dir):
.with_model_uri(local_model_uri) \
.build()

def preprocess_command(self, command_type, experiment_config,
def update_for_command(self, command_type, experiment_config,
context=None):
conf, io_def = super().preprocess_command(command_type,
conf, io_def = super().update_for_command(command_type,
experiment_config, context)
if command_type == rv.CHIP:
if not conf.training_data_uri:
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def to_proto(self):
pass

@abstractmethod
def preprocess_command(self, command_type, experiment_config,
def update_for_command(self, command_type, experiment_config,
context=None):
"""Returns a copy of this config which may or may not have
been modified based on the command needs and the experiment
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,14 @@ def to_proto(self):
test_scenes=test_scenes,
augmentors=augmentors)

def preprocess_command(self, command_type, experiment_config,
def update_for_command(self, command_type, experiment_config,
context=None):
io_def = rv.core.CommandIODefinition()

if command_type in [rv.ANALYZE, rv.CHIP]:
train_scenes = []
for scene in self.train_scenes:
(new_config, scene_io_def) = scene.preprocess_command(
(new_config, scene_io_def) = scene.update_for_command(
command_type, experiment_config, context)
io_def.merge(scene_io_def)
train_scenes.append(new_config)
Expand All @@ -109,7 +109,7 @@ def preprocess_command(self, command_type, experiment_config,
.with_task(experiment_config.task) \
.with_label_store() \
.build()
(new_config, scene_io_def) = scene.preprocess_command(
(new_config, scene_io_def) = scene.update_for_command(
command_type, experiment_config, context)
io_def.merge(scene_io_def)
val_scenes.append(new_config)
Expand All @@ -124,7 +124,7 @@ def preprocess_command(self, command_type, experiment_config,
.with_task(experiment_config.task) \
.with_label_store() \
.build()
(new_config, scene_io_def) = scene.preprocess_command(
(new_config, scene_io_def) = scene.update_for_command(
command_type, experiment_config, context)
io_def.merge(scene_io_def)
test_scenes.append(new_config)
Expand All @@ -135,7 +135,7 @@ def preprocess_command(self, command_type, experiment_config,
if command_type == rv.CHIP:
augmentors = []
for augmentor in self.augmentors:
(new_config, aug_io_def) = augmentor.preprocess_command(
(new_config, aug_io_def) = augmentor.update_for_command(
command_type, experiment_config, context)
io_def.merge(aug_io_def)
augmentors.append(new_config)
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def create_source(self, task_config, extent, crs_transformer, tmp_dir):
self.pick_min_class_id, self.background_class_id, self.cell_size,
self.infer_cells)

def preprocess_command(self, command_type, experiment_config, context=[]):
def update_for_command(self, command_type, experiment_config, context=[]):
conf = self
io_def = rv.core.CommandIODefinition()
io_def.add_input(self.uri)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import rastervision as rv


class DefaultLabelSourceProvider(ABC):
class LabelSourceDefaultProvider(ABC):
@staticmethod
@abstractmethod
def handles(task_type, s):
Expand All @@ -18,7 +18,7 @@ def construct(s):
pass


class DefaultObjectDetectionGeoJSONSourceProvider(DefaultLabelSourceProvider):
class ObjectDetectionGeoJSONSourceDefaultProvider(LabelSourceDefaultProvider):
@staticmethod
def handles(task_type, uri):
if task_type == rv.OBJECT_DETECTION:
Expand All @@ -33,8 +33,8 @@ def construct(uri):
.build()


class DefaultChipClassificationGeoJSONSourceProvider(
DefaultLabelSourceProvider):
class ChipClassificationGeoJSONSourceDefaultProvider(
LabelSourceDefaultProvider):
@staticmethod
def handles(task_type, uri):
if task_type == rv.CHIP_CLASSIFICATION:
Expand All @@ -49,8 +49,8 @@ def construct(uri):
.build()


class DefaultSemanticSegmentationRasterSourceProvider(
DefaultLabelSourceProvider):
class SemanticSegmentationRasterSourceDefaultProvider(
LabelSourceDefaultProvider):
@staticmethod
def handles(task_type, uri):
if task_type == rv.SEMANTIC_SEGMENTATION:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def create_source(self, task_config, extent, crs_transformer, tmp_dir):
return ObjectDetectionGeoJSONSource(self.uri, crs_transformer,
task_config.class_map, extent)

def preprocess_command(self, command_type, experiment_config, context=[]):
def update_for_command(self, command_type, experiment_config, context=[]):
io_def = rv.core.CommandIODefinition()
io_def.add_input(self.uri)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@ def create_source(self, task_config, extent, crs_transformer, tmp_dir):
self.source.create_source(tmp_dir, extent, crs_transformer),
self.rgb_class_map)

def preprocess_command(self, command_type, experiment_config, context=[]):
def update_for_command(self, command_type, experiment_config, context=[]):
if context is None:
context = []
context = context + [self]
io_def = rv.core.CommandIODefinition()

b = self.to_builder()

(new_raster_source, sub_io_def) = self.source.preprocess_command(
(new_raster_source, sub_io_def) = self.source.update_for_command(
command_type, experiment_config, context)

io_def.merge(sub_io_def)
Expand Down Expand Up @@ -87,7 +87,7 @@ def with_raster_source(self, source, channel_order=None):
if isinstance(source, RasterSourceConfig):
b.config['source'] = source
elif isinstance(source, str):
provider = rv._registry.get_default_raster_source_provider(source)
provider = rv._registry.get_raster_source_default_provider(source)
source = provider.construct(source, channel_order=channel_order)
b.config['source'] = source
else:
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def create_store(self, task_config, extent, crs_transformer, tmp_dir):
return ChipClassificationGeoJSONStore(self.uri, crs_transformer,
task_config.class_map)

def preprocess_command(self, command_type, experiment_config, context=[]):
def update_for_command(self, command_type, experiment_config, context=[]):
conf = self
io_def = rv.core.CommandIODefinition()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import rastervision as rv


class DefaultLabelStoreProvider(ABC):
class LabelStoreDefaultProvider(ABC):
@staticmethod
@abstractmethod
def is_default_for(task_type):
Expand All @@ -24,7 +24,7 @@ def construct(s=None):
pass


class DefaultObjectDetectionGeoJSONStoreProvider(DefaultLabelStoreProvider):
class ObjectDetectionGeoJSONStoreDefaultProvider(LabelStoreDefaultProvider):
@staticmethod
def is_default_for(task_type):
return task_type == rv.OBJECT_DETECTION
Expand All @@ -45,7 +45,7 @@ def construct(uri=None):
return b.build()


class DefaultChipClassificationGeoJSONStoreProvider(DefaultLabelStoreProvider):
class ChipClassificationGeoJSONStoreDefaultProvider(LabelStoreDefaultProvider):
@staticmethod
def is_default_for(task_type):
return task_type == rv.CHIP_CLASSIFICATION
Expand All @@ -65,8 +65,8 @@ def construct(uri=None):
return b.build()


class DefaultSemanticSegmentationRasterStoreProvider(
DefaultLabelStoreProvider):
class SemanticSegmentationRasterStoreDefaultProvider(
LabelStoreDefaultProvider):
@staticmethod
def is_default_for(task_type):
return task_type == rv.SEMANTIC_SEGMENTATION
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def create_store(self, task_config, extent, crs_transformer, tmp_dir):
return ObjectDetectionGeoJSONStore(self.uri, crs_transformer,
task_config.class_map)

def preprocess_command(self, command_type, experiment_config, context=[]):
def update_for_command(self, command_type, experiment_config, context=[]):
conf = self
io_def = rv.core.CommandIODefinition()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def create_store(self, task_config, extent, crs_transformer, tmp_dir):
return SemanticSegmentationRasterStore(
self.uri, extent, crs_transformer, tmp_dir, class_map=class_map)

def preprocess_command(self, command_type, experiment_config, context=[]):
def update_for_command(self, command_type, experiment_config, context=[]):
conf = self
io_def = rv.core.CommandIODefinition()

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit f33a96d

Please sign in to comment.