Skip to main content

Command Line Interface tool for flockfysh.

Project description

Build and upload to PyPI

To build the package:

pip install build
python -m build

To upload the package:

pip install twine
python -m twine upload --repository pypi dist/*

General use

Everything you need is stored in the ffysh import or in the ffysh CLI - you don't need to worry about its submodules.

Create a project and log in to Flockfysh

  1. Ensure your current working directory is correct.
  2. From the terminal, run these two commands:
    ffysh init
    ffysh login
    
  3. Log in to Flockfysh using the new browser window and click Approve to allow ffysh to use your account.

Datasets

  1. You'll first need to create a Dataset object first, using the 24-character ID of the dataset you want. If the dataset does not exist, an error will be thrown.

    from ffysh import Dataset
    
    dataset = Dataset("some_dataset_id")
    
  2. From there, you can create a stream object.

    stream = dataset.create_stream()
    

Additional dataset attributes and methods:

# Print dataset ID.
print(dataset.dataset_id)

Streams

Streams are the basic unit of operation in ffysh. Each stream is a lazy-loaded snapshot of a dataset, and it expands as much as the user needs. Alternatively, you can use it as if it is a Python list.

  1. First, store the ID of the stream for later use.

    with open("stream_id.json", "w") as file:
        json.dump({"id": stream.stream_id}, file)
    
  2. This allows the stream to reload from disk.

    from ffysh import Stream
    
    with open("stream_id.json", "w") as file:
       stream = Stream.load(json.load(file)["id"]
    

    Note that each stream instance can only be created or loaded once, and if it is load twice, the old stream instance will be returned.

    with open("stream_id.json", "w") as file:
       stream2 = Stream.load(json.load(file)["id"]
    
    print(stream is stream2) # True
    
  3. Stream methods:

    from ffysh import Stream
    
    with open("stream_id.json", "w") as file:
        stream = Stream.load(json.load(file)["id"]
    
    # Iteration
    for asset in stream:
        print(asset)
    
    # Stream indexing and slicing
    print(stream[0:5:2])
    
    # Loads the next 5 items that has not been loaded yet 
    # into the cache, and return them. If the stream ends, 
    # an empty list is returned, and any more calls will raise 
    # a StopIteration exception.
    stream.next_assets(5)
    
    # Expands the stream until the stream ends or is at least 100 
    # items long by loading more items from the cache.
    stream.expand(100)
    
    # Expands the stream until the end.
    stream.expand()
    
    # Convert the entire stream to a PyTorch zip.
    stream.to_pytorch("./dataset.zip", confidence_level=0.6)
    

Limitations

  1. You must not use a stream in 2 Python programs at a time. If you want to, create a second stream or quit the first program. Although you still have to re-download labels, images will be cached in a separate directory, so that multiple streams can access the same asset.
  2. Even if assets and their labels are deleted remotely, they will stay intact locally. We'll introduce a way to discard unused streams and purge redundant images in the future.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fysh-0.0.1.9.tar.gz (17.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fysh-0.0.1.9-py3-none-any.whl (21.9 kB view details)

Uploaded Python 3

File details

Details for the file fysh-0.0.1.9.tar.gz.

File metadata

  • Download URL: fysh-0.0.1.9.tar.gz
  • Upload date:
  • Size: 17.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.6.1 CPython/3.10.12 Linux/5.15.0-1041-azure

File hashes

Hashes for fysh-0.0.1.9.tar.gz
Algorithm Hash digest
SHA256 68308ce8864680641e5ebc524ca062a7f3d2f6fac813b43ffd9ae9fa1490f20d
MD5 7b0b51e96b24d1f7979ae475c5f30271
BLAKE2b-256 6fd2c5d135e92a5a38e6aa8cb7722c97e175c03ff90df80f42e8083d64383306

See more details on using hashes here.

File details

Details for the file fysh-0.0.1.9-py3-none-any.whl.

File metadata

  • Download URL: fysh-0.0.1.9-py3-none-any.whl
  • Upload date:
  • Size: 21.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.6.1 CPython/3.10.12 Linux/5.15.0-1041-azure

File hashes

Hashes for fysh-0.0.1.9-py3-none-any.whl
Algorithm Hash digest
SHA256 a79f0e286fa4b2c616f8ed11bac01a1c3c8740bbe01007c273e339ffae8d5f14
MD5 afbdd7a5b03dc0a1b3c3326082479786
BLAKE2b-256 79f01a7a95fc51baa798de0749435f6933b0b10e4b89de63c22fb2c85394d1d9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page