فهرست منبع

fixed Resnet prepare func

Dimitri Korsch 3 سال پیش
والد
کامیت
4f304a41d5
2فایلهای تغییر یافته به همراه11 افزوده شده و 2 حذف شده
  1. 10 1
      cvmodelz/models/pretrained/resnet.py
  2. 1 1
      setup.py

+ 10 - 1
cvmodelz/models/pretrained/resnet.py

@@ -26,9 +26,18 @@ class BaseResNet(PretrainedModelMixin):
 
 			classifier_layers=["fc6"],
 
-			prepare_func=prepare,
+			prepare_func=self.prepare,
 		)
 
+	def prepare(self, x, size=None, *, swap_channels=True, keep_ratio=True):
+		x = prepare(x, size)
+
+		# if not desired, we need to undo it
+		if not swap_channels:
+			x = x[:, :, ::-1]
+
+		return x
+
 	@property
 	def functions(self):
 		return super().functions

+ 1 - 1
setup.py

@@ -21,7 +21,7 @@ install_requires = [
 setup(
 	name=pkg_name,
 	version=__version__,
-	python_requires=">3.6",
+	python_requires=">3.7",
 	description='Wrapper for various computer vision models (mostly provided by chainer, chainercv, and chainercv2)',
 	log_description=open(str(cwd / "README.md")).read(),
 	author='Dimitri Korsch',