From 9c63318b6f1a3facb7a24599b53337426e82c79c Mon Sep 17 00:00:00 2001 From: realsanjeev2 Date: Thu, 8 May 2025 15:45:17 +0545 Subject: [PATCH] Fix the issue when using latest python libraries on python 3.10 - Updated import for timm modules(previous implementation was deprecated) - removed verbose parameter passing in ReduceLROnPlateau as it is not available in latest 2.1 torch implementation - Using regular float instead of np.float(1.0) as this was removed onward 2.* numpy implementation - Added gitignore and requirement.txt for quick use --- .gitignore | 3 +++ common/load_data_hm36.py | 2 +- main.py | 2 +- model/Block.py | 2 +- requirement.txt | 7 ++++++- 5 files changed, 12 insertions(+), 4 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f16ff18 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +__pycache__ +dataset +runs \ No newline at end of file diff --git a/common/load_data_hm36.py b/common/load_data_hm36.py index 0a28db0..8bb0cc9 100644 --- a/common/load_data_hm36.py +++ b/common/load_data_hm36.py @@ -160,7 +160,7 @@ def __getitem__(self, index): bb_box = np.array([0, 0, 1, 1]) input_2D_update = input_2D - scale = np.float(1.0) + scale = float(1.0) return cam, gt_3D, input_2D_update, action, subject, scale, bb_box, cam_ind diff --git a/main.py b/main.py index 711c44f..0e17902 100644 --- a/main.py +++ b/main.py @@ -132,7 +132,7 @@ def input_augmentation(input_2D, model): lr = opt.lr all_param += list(model.parameters()) optimizer = optim.Adam(all_param, lr=opt.lr, amsgrad=True) - scheduler = torch.optim.lr_scheduler.ReduceLROnPlateau(optimizer, 'min', factor=0.317, patience=5, verbose=True) + scheduler = torch.optim.lr_scheduler.ReduceLROnPlateau(optimizer, 'min', factor=0.317, patience=5) for epoch in range(1, opt.nepoch): if opt.train: diff --git a/model/Block.py b/model/Block.py index f272a5b..6aa2a66 100644 --- a/model/Block.py +++ b/model/Block.py @@ -3,7 +3,7 @@ import torch.nn as nn from timm.data import IMAGENET_DEFAULT_MEAN, IMAGENET_DEFAULT_STD -from timm.models.layers import DropPath +from timm.layers import DropPath from model.GCN_conv import ModulatedGraphConv from model.Transformer import Attention, Mlp diff --git a/requirement.txt b/requirement.txt index c655d0c..d15935e 100644 --- a/requirement.txt +++ b/requirement.txt @@ -3,4 +3,9 @@ timm tensorboardX scipy filterpy -tqdm \ No newline at end of file +tqdm +yacs +opencv-python +numba +scikit-image +IPython