You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

eval.py 2.1 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. # Copyright 2021 The KubeEdge Authors.
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License");
  4. # you may not use this file except in compliance with the License.
  5. # You may obtain a copy of the License at
  6. #
  7. # http://www.apache.org/licenses/LICENSE-2.0
  8. #
  9. # Unless required by applicable law or agreed to in writing, software
  10. # distributed under the License is distributed on an "AS IS" BASIS,
  11. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. # See the License for the specific language governing permissions and
  13. # limitations under the License.
  14. import os.path
  15. from sedna.common.config import Context
  16. from sedna.core.incremental_learning import IncrementalLearning
  17. from interface import Estimator
  18. from dataset import ImgDataset
  19. def main():
  20. class_names=Context.get_parameters("class_name")
  21. print(Context.get_parameters("model_path"))
  22. #read parameters from deployment config
  23. input_shape=int(Context.get_parameters("input_shape"))
  24. batch_size=int(Context.get_parameters("batch_size"))
  25. original_dataset_url=Context.get_parameters("ORIGINAL_DATASET_URL")
  26. num_parallel_workers=int(Context.get_parameters("num_parallel_workers"))
  27. if original_dataset_url:
  28. print("ORIGINAL_DATASET_URL"+ original_dataset_url)
  29. else:
  30. print("ORIGINAL_DATASET_URL: NULL" )
  31. eval_dataset_path=os.path.dirname(original_dataset_url)+r"/eval"
  32. test_data=ImgDataset(data_type="eval").parse(path=eval_dataset_path,
  33. train=False,
  34. image_shape=input_shape,
  35. batch_size=batch_size,
  36. num_parallel_workers=num_parallel_workers)
  37. incremental_instance = IncrementalLearning(estimator=Estimator)
  38. return incremental_instance.evaluate(test_data,
  39. class_names=class_names,
  40. input_shape=input_shape)
  41. if __name__ == "__main__":
  42. main()