Hello, recently, I was fortunate enough to read your article _mxr-u-nets for real time hyperspectral reconstruction_. I am very interested in your research. At the same time, I also read the code you published. According to your code, I have studied, but encountered the following problems, I would like to ask you.
Here is my question:
- When I open the program file, I found that many packages were not imported. Here are some packages I imported.
train.py:
`from functools import partial
from fastai.callback.tracker import SaveModelCallback from fastai.layers import NormType
from fastai.vision.learner import unet_learner
import torch.nn.functional as F
from fastai.vision import models
import sys
data.py:
import matplotlib.pyplot as plt
import torch.nn.functional as F
import sys
from fastcore.utils import ifnone
from pyparsing import Optional
from torchvision.models.detection.image_list import ImageList from traitlets import Tuple
from fastai.torch_core import tensor`
2.When I ran the train.py file, because I added the following statements, a new error occurred. Have you encountered it? Is there a solution?
from fastcore.utils import ifnone from pyparsing import Optional from torchvision.models.detection.image_list import ImageList from traitlets import Tuple
New error:
File "D:/github/PixxelAI/train.py", line 48, in
from data import *
File "D:\github\PixxelAI\data.py", line 73, in
class HSImageListTIFF(ImageList):
File "D:\github\PixxelAI\data.py", line 78, in HSImageListTIFF
def show_xys(self, xs, ys, imgsize:int=4, figsize:Optional[Tuple[int,int]]=None, **kwargs):
TypeError: 'type' object is not subscriptable
- utils.py:
In this file, there are the following statements:
from fastai.vision import Rank0Tensor from fastai.vision import flatten_check
But when I was studying, an error message appeared, as shown below:
File "D:/github/PixxelAI/utils.py", line 6, in
from fastai.vision import Rank0Tensor
ImportError: cannot import name 'Rank0Tensor' from 'fastai.vision'
File "D:/github/PixxelAI/utils.py", line 7, in
from fastai.vision import flatten_check
ImportError: cannot import name 'flatten_check' from 'fastai.vision'
I made changes, I don’t know if it’s possible, as shown below:
from fastai.torch_core import Tensor from fastai.layers import flatten_check
4. feature.py:
In this file, there are the following statements:
from fastai.torch_core import requires_grad, children from fastai.callbacks.hooks import hook_outputs
But when I was studying, an error message appeared, as shown below:
from fastai.torch_core import requires_grad, children
ImportError: cannot import name'children' from'fastai.torch_core'
from fastai.torch_core import requires_grad, children
ImportError: cannot import name'children' from'fastai.torch_core'
Have you encountered such a problem, and how did you correct it?
Now, it's hard for me to solve these problems. Looking forward to your answers.