Using SAM-LSTM-RESNET

I was using the SAM-LSTM-RESNET package and i had a this shape problem.

It is also happenning with the examples pics that come with the package, so it’s very wierd that it does not work as it should. Someone knoes how to fix this without modifying the package’s code?

from sam_lstm import SalMap
import os

if not os.path.exists("\samples"):
    os.makedirs("\samples")

SalMap.auto()

and this was the traceback

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
Input In [5], in <cell line: 9>()
      6 if not os.path.exists("\samples"):
      7     os.makedirs("\samples")
----> 9 SalMap.auto()

File ~anaconda3libsite-packagessam_lstm__init__.py:48, in SalMap.auto(cls)
     45 @classmethod
     46 def auto(cls):
     47     salmap = cls()
---> 48     salmap.compile()
     49     salmap.load_weights()
     50     salmap.predict_maps()

File ~anaconda3libsite-packagessam_lstm__init__.py:59, in SalMap.compile(self)
     57 def compile(self):
     58     self.model = Model(
---> 59         inputs=[self.x, self.x_maps], outputs=sam_resnet([self.x, self.x_maps])
     60     )
     61     self.model.compile(
     62         RMSprop(learning_rate=1e-4),
     63         loss=[kl_divergence, correlation_coefficient, nss],
     64         loss_weights=[10, -2, -1],
     65     )

File ~anaconda3libsite-packagessam_lstmmodels.py:192, in sam_resnet(x)
    190 def sam_resnet(x):
    191     # Dilated Convolutional Network
--> 192     dcn = dcn_resnet(input_tensor=x[0])
    193     conv_feat = Conv2D(512, (3, 3), padding="same", activation="relu")(dcn.output)
    194     # Attentive Convolutional LSTM

File ~anaconda3libsite-packagessam_lstmdcn_resnet.py:259, in dcn_resnet(input_tensor)
    252 # Load weights
    253 weights_path = get_file(
    254     "resnet50_weights_th_dim_ordering_th_kernels_notop.h5",
    255     TH_WEIGHTS_PATH_NO_TOP,
    256     cache_subdir="weights",
    257     file_hash="f64f049c92468c9affcd44b0976cdafe",
    258 )
--> 259 model.load_weights(weights_path)
    261 return model

File ~anaconda3libsite-packageskerassrcutilstraceback_utils.py:122, in filter_traceback.<locals>.error_handler(*args, **kwargs)
    119     filtered_tb = _process_traceback_frames(e.__traceback__)
    120     # To get the full stack trace, call:
    121     # `keras.config.disable_traceback_filtering()`
--> 122     raise e.with_traceback(filtered_tb) from None
    123 finally:
    124     del filtered_tb

File ~anaconda3libsite-packageskerassrcbackendcommonvariables.py:226, in KerasVariable.assign(self, value)
    224 value = self._convert_to_tensor(value, dtype=self.dtype)
    225 if not shape_equal(value.shape, self.shape):
--> 226     raise ValueError(
    227         "The shape of the target variable and "
    228         "the shape of the target value in "
    229         "`variable.assign(value)` must match. "
    230         f"variable.shape={self.value.shape}, "
    231         f"Received: value.shape={value.shape}. "
    232         f"Target variable: {self}"
    233     )
    234 if in_stateless_scope():
    235     scope = get_stateless_scope()

ValueError: The shape of the target variable and the shape of the target value in `variable.assign(value)` must match. variable.shape=(7, 7, 3, 64), Received: value.shape=(64, 3, 7, 7). Target variable: <KerasVariable shape=(7, 7, 3, 64), dtype=float32, path=conv1/kernel>

ass you can see the error is basicaly the shape that is transposed somehow but i don’t know how to fix it?

New contributor

damian antonio gonzo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật