Skip to content

Commit

Permalink
Fixed download error due to missing directories. Added docker docs. F…
Browse files Browse the repository at this point in the history
…ixed package redownload due to TF package naming conventions.
  • Loading branch information
sebastian-sz committed Jun 28, 2021
1 parent f32b8c6 commit 9579460
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 2 deletions.
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,16 @@ pip install .
### (Alternatively) No install:
If you do not want to install you could just drop the `efficientnet_lite/efficientnet_lite.py` file directly into your project.

### Docker
You can also install this package as an extension to official Tensorflow docker container:

Build: `docker build -t efficientnet_lite_keras .`
Run: `docker run -it --rm efficientnet_lite_keras`

For GPU support or different TAG you can (for example) pass
`--build-arg IMAGE_TAG=2.5.0-gpu`
in build command.

### Verify installation
If all goes well you should be able to import:
`from efficientnet_lite import *`
Expand Down Expand Up @@ -107,7 +117,7 @@ description of Lite variants.
### (Optionally) Convert the weights
I am hosting the converted weights on DropBox. If, for some reason, you wish to download and convert original weights yourself, I prepered the utility scripts:
1. `bash scripts/download_all_weights.sh`
2. `bash scripts/conver_all_weights.sh`
2. `bash scripts/convert_all_weights.sh`

# Bibliography
[1] [Original repository](https://github.com/tensorflow/tpu/tree/master/models/official/efficientnet/lite)
Expand Down
27 changes: 26 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,33 @@
from pkg_resources import DistributionNotFound, get_distribution
from setuptools import setup

with open("README.md", encoding="utf-8") as f:
long_description = "\n" + f.read()


def _package_exists(name: str) -> bool:
"""Check whether package is present in the system."""
try:
get_distribution(name)
except DistributionNotFound:
return False
else:
return True


def _get_tensorflow_requirement():
"""Avoid re-download and misdetection of package."""
lower = 2.2
upper = 2.6

if _package_exists("tensorflow-cpu"):
return [f"tensorflow-cpu>={lower},<{upper}"]
elif _package_exists("tensorflow-gpu"):
return [f"tensorflow-gpu>={lower},<{upper}"]
else:
return [f"tensorflow>={lower},<{upper}"]


setup(
name="efficientnet-lite-keras",
version="1.0",
Expand All @@ -20,5 +45,5 @@
"Programming Language :: Python :: 3",
],
packages=["efficientnet_lite"],
install_requires=["tensorflow>=2.2,<2.6"],
install_requires=_get_tensorflow_requirement(),
)
Empty file.

0 comments on commit 9579460

Please sign in to comment.