Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix raster.inference() args #65

Merged
merged 16 commits into from
Sep 15, 2024
Merged

fix raster.inference() args #65

merged 16 commits into from
Sep 15, 2024

Conversation

dhodcz2
Copy link
Collaborator

@dhodcz2 dhodcz2 commented Apr 23, 2024

Previously --dump_percent was hardcoded to args. Now this:

        args = [
            "python",
            "-m",
            "tile2net",
            "inference",
            *args,
        ]
        sargs = set(args)
        if '--city_info' not in sargs:
            args.extend(['--city_info', str(info)])
        if '--dump_percent' not in sargs:
            args.extend(['--dump_percent', str(self.dump_percent)])
        if '--interactive' not in sargs:
            args.append('--interactive')

This adds dump_percent to the args if not passed.
Previous commits were functional however failing test_namespace because the test_namespace function checks for all accesses to args in the project however the previous code block added args.append which was not part of the Namespace but still valid.

As discussed by #70 we comment out using psutil.disk_usage to warn the user that they have enough space for inference:

        # disabled because of python 3.12 bug
        # free = psutil.disk_usage(path.__fspath__()).free
        # if free > 2 * 2 ** 30:
        #     ...
        # elif free > 1 * 2 ** 30:
        #     warnings.warn(f'Low disk space: {free / 2 ** 30} GB')
        # else:
        #     warnings.warn(f'Very low disk space: {free / 2 ** 20} MB')

This is not a very important feature however it is currently incompatible with the latest version of python.

We handle cases where the input dir is not set when trying to visualize it:

    def __repr__(self):
        if not self.original:
            return f'{super().__repr__()} not set'
        return self.original

    def __str__(self):
        if not self.original:
            return f'{super().__repr__()} not set'
        return self.original

@Mary-h86 Mary-h86 merged commit 726982b into main Sep 15, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants