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

Issue of converting the trained NPZ model into ProtoBuf format #389

Open
maketo97 opened this issue Apr 7, 2022 · 0 comments
Open

Issue of converting the trained NPZ model into ProtoBuf format #389

maketo97 opened this issue Apr 7, 2022 · 0 comments

Comments

@maketo97
Copy link

maketo97 commented Apr 7, 2022

@syoyo @sukhodolin @luomai @lgarithm @Yuyue

Hi, I do the conversion of lightweight openpose vggtiny given by the authors using the 'export_pb.py' but encounter the error. May you help me in this issue? Thanks in advance.

Log file for the execution of 'export_pb.py":-

2022-04-07 16:04:34.939061: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library cudart64_101.dll
2022-04-07 16:04:37.196428: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library nvcuda.dll
2022-04-07 16:04:38.231690: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1716] Found device 0 with properties:
pciBusID: 0000:01:00.0 name: NVIDIA GeForce GTX 1660 Ti computeCapability: 7.5
coreClock: 1.59GHz coreCount: 24 deviceMemorySize: 6.00GiB deviceMemoryBandwidth: 268.26GiB/s
2022-04-07 16:04:38.231824: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library cudart64_101.dll
2022-04-07 16:04:38.234714: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library cublas64_10.dll
2022-04-07 16:04:38.237753: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library cufft64_10.dll
2022-04-07 16:04:38.238956: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library curand64_10.dll
2022-04-07 16:04:38.242075: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library cusolver64_10.dll
2022-04-07 16:04:38.243890: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library cusparse64_10.dll
2022-04-07 16:04:38.250656: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library cudnn64_7.dll
2022-04-07 16:04:38.250867: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1858] Adding visible gpu devices: 0
[INFO]: Configuration initialized!
[MODEL] INFO: Setting Vggtiny_backbone!
[MODEL] INFO: Enable model backbone pretraining:False
2022-04-07 16:04:38.713381: I tensorflow/core/platform/cpu_feature_guard.cc:142] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN)to use the following CPU instructions in performance-critical operations: AVX2
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
2022-04-07 16:04:38.720480: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x27c9f0da7d0 initialized for platform Host (this does not guarantee that XLA will be used). Devices:
2022-04-07 16:04:38.720618: I tensorflow/compiler/xla/service/service.cc:176] StreamExecutor device (0): Host, Default Version
2022-04-07 16:04:39.231945: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1716] Found device 0 with properties:
pciBusID: 0000:01:00.0 name: NVIDIA GeForce GTX 1660 Ti computeCapability: 7.5
coreClock: 1.59GHz coreCount: 24 deviceMemorySize: 6.00GiB deviceMemoryBandwidth: 268.26GiB/s
2022-04-07 16:04:39.232143: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library cudart64_101.dll
2022-04-07 16:04:39.232955: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library cublas64_10.dll
2022-04-07 16:04:39.233246: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library cufft64_10.dll
2022-04-07 16:04:39.234553: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library curand64_10.dll
2022-04-07 16:04:39.234594: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library cusolver64_10.dll
2022-04-07 16:04:39.234623: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library cusparse64_10.dll
2022-04-07 16:04:39.234866: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library cudnn64_7.dll
2022-04-07 16:04:39.234949: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1858] Adding visible gpu devices: 0
2022-04-07 16:04:39.791163: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1257] Device interconnect StreamExecutor with strength 1 edge matrix:
2022-04-07 16:04:39.791302: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1263] 0
2022-04-07 16:04:39.791786: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1276] 0: N
2022-04-07 16:04:39.792406: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1402] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 4743 MB memory) -> physical GPU (device: 0, name: NVIDIA GeForce GTX 1660 Ti, pci bus id: 0000:01:00.0, compute capability: 7.5)
2022-04-07 16:04:39.796529: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x27cc1277d60 initialized for platform CUDA (this does not guarantee that XLA will be used). Devices:
2022-04-07 16:04:39.796586: I tensorflow/compiler/xla/service/service.cc:176] StreamExecutor device (0): NVIDIA GeForce GTX 1660 Ti, Compute Capability 7.5
[MODEL] INFO: Using LightweightOpenpose model arch!

[INFO]: Welcome to Hyperpose Development Platform!

====================================================================================================
[INFO]: Variable Definition:
[INFO]: parts: the joints of human body, Enum class
[INFO]: limbs: the limbs of human body, List of tuple. example: [(joint index 1, joint index 2),...]
[INFO]: colors: the visualize color for each parts, List. example: [(0,0,255),...] (optional)
[INFO]: n_parts: number of human body joints, int. example: n_parts=len(parts)
[INFO]: n_limbs: number of human body limbs, int. example: n_limbs=len(limbs)
[INFO]: hin: height of the model input image, int. example: 368
[INFO]: win: width of the model input image, int. example: 368
[INFO]: hout: height of model output heatmap, int. example: 46
[INFO]: wout: wout of model output heatmap, int. example: 46

====================================================================================================
[INFO]: Object Definition:
[INFO]: config: a object contains all the configurations used to assemble the model, dataset, and pipeline. easydict object.
return by the Config.get_config function.

[INFO]: model: a neural network takes in the image and output the calculated activation map. BasicModel object.
have forward, cal_loss, infer(optional) functions.
custom: users could inherit the Model.BasicModel class for customization.
example: please refer to Model.LightWeightOpenPose class for details.

[INFO]: dataset: a dataset generator provides train and evaluate dataset. Base_dataset object.
have get_train_dataset and get_eval_dataset functions.
custom: users could inherit the Dataset.BasicDataset class for customizationn
example: please refer to Datset.CocoDataset class for details.

[INFO]: augmentor: a data augmentor that takes in the image, key point annotation, mask and perform affine transformation for data augmentation. BasicAumentor object.
have process and process_only_image functions.
custom: users could inherit the Model.BasicAugmentor class for customization.
example: please refer to Model.BasicAugmentor class for details.

[INFO]: preprocessor: a data preprocessor that takes in the image, key point annotation and mask to produce the target heatmap
for model to calculate loss and learn. BasicPreProcessor object.
have process function.
custom: users could inherit the Model.BasicPreProcessor class for customizationn
example: please refer to Model.openpose.PreProcessor class for details.

[INFO]: postprocessor: a data postprocessor that takes in the predicted heatmaps and infer the human body joints and limbs.
have process function. BasicPostProcessor object.
custom: users could inherit the Model.BasicPostProcessor class for customization
example: please refer to the Model.openpose.PostProcessor class for details.

[INFO]: visualizer: a visualizer that takes in the predicted heatmaps and output visualization images for train and evaluation.
have visualize and visualize_comapre functions. BasicVisualizer object.
custom: users could inherit the Model.BasicVisualizer class for customization.
example: please refer to the Model.openpose.Visualizer class for details.

====================================================================================================
[INFO]: Development platform basic usage:
1.Use the sets APIs of Config module to configure the pipeline, choose the algorithm type, the neural network
backbone, the dataset etc. that best fit your application scenario.
2.Use the get_model API of Model module to get the configured model, use get_dataset API of dataset module to
get the configured dataset, use the get_train API of Model module to get the configured train procedure. Then start
training! Check the loss values and sample training result images during training.
3.Use the get_eval API of Model module to get the configured evaluation procedure. evaluate the model you trained.
4.Eport the model to .pb, .onnx, .tflite formats for deployment.
[INFO]: Development platform custom usage:
Hyperpose enables users to custom model, dataset, augmentor, preprocessor, postprocessor and visualizer.
Users could inherit the corresponding basic class(mentioned above), and implement corresponding the member functions
required according to the function annotation, then use Config.set_custom_xxx APIs to set the custom component.
[INFO]: Additional features:
1.Parallel distributed training with Kungfu.
2.Domain adaption to leverage unlabled data.
3.Neural network backbone pretraining.
[INFO]: Currently all the procedures are uniformed to be channels_first data format.
[INFO]: Currently all model weights are saved in npz_dict format.

====================================================================================================
export_batch_size=None export_h=None export_w=None
Exporting model MyLightweightOpenpose from ./save_dir/MyLightweightOpenpose/model_dir/newest_model.npz...
Traceback (most recent call last):
File "export_pb.py", line 87, in
export_model.load_weights(input_path)
File "C:\Users\User\anaconda3\lib\site-packages\tensorlayer\models\core.py", line 958, in load_weights
utils.load_and_assign_npz(filepath, self)
File "C:\Users\User\anaconda3\lib\site-packages\tensorlayer\files\utils.py", line 2045, in load_and_assign_npz
weights = load_npz(name=name)
File "C:\Users\User\anaconda3\lib\site-packages\tensorlayer\files\utils.py", line 1985, in load_npz
return d['params']
File "C:\Users\User\anaconda3\lib\site-packages\numpy\lib\npyio.py", line 266, in getitem
raise KeyError("%s is not a file in the archive" % key)
KeyError: 'params is not a file in the archive'

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

No branches or pull requests

1 participant