Giter Club home page Giter Club logo

Comments (7)

xyupeng avatar xyupeng commented on May 29, 2024

Would you please let me know in which config/job you met the problem?

from contrastivecrop.

syfffffff avatar syfffffff commented on May 29, 2024

I added this code to the TSN network and added it to the training part, but the 'box' parameter was abnormal when calling

from contrastivecrop.

syfffffff avatar syfffffff commented on May 29, 2024

def get_augmentation(self): if self.modality == 'RGB': return torchvision.transforms.Compose([ GroupMultiScaleCrop(self.input_size, [1, .875, .75, .66]), GroupRandomHorizontalFlip(is_flow=False), # 增加数据增强 ContrastiveCrop(size=32, scale=(0.2, 1.0)) ])

from contrastivecrop.

syfffffff avatar syfffffff commented on May 29, 2024

Traceback (most recent call last): File "D:\download\TSN-pytorch\main.py", line 165, in <module> main() File "D:\download\TSN-pytorch\main.py", line 139, in main train(args.record_path,train_loader, model, criterion, optimizer, epoch, args.clip_gradient) File "D:\download\TSN-pytorch\train.py", line 18, in train for i, (data, target) in enumerate(train_loader): File "C:\Users\lenovo\anaconda3\envs\pytorch\lib\site-packages\torch\utils\data\dataloader.py", line 521, in __next__ data = self._next_data() File "C:\Users\lenovo\anaconda3\envs\pytorch\lib\site-packages\torch\utils\data\dataloader.py", line 561, in _next_data data = self._dataset_fetcher.fetch(index) # may raise StopIteration File "C:\Users\lenovo\anaconda3\envs\pytorch\lib\site-packages\torch\utils\data\_utils\fetch.py", line 44, in fetch data = [self.dataset[idx] for idx in possibly_batched_index] File "C:\Users\lenovo\anaconda3\envs\pytorch\lib\site-packages\torch\utils\data\_utils\fetch.py", line 44, in <listcomp> data = [self.dataset[idx] for idx in possibly_batched_index] File "D:\download\TSN-pytorch\dataset\dataset.py", line 67, in __getitem__ return self._get(record, segment_indices) File "D:\download\TSN-pytorch\dataset\dataset.py", line 122, in _get process_data = self.transform(images) File "C:\Users\lenovo\anaconda3\envs\pytorch\lib\site-packages\torchvision\transforms\transforms.py", line 60, in __call__ img = t(img) File "C:\Users\lenovo\anaconda3\envs\pytorch\lib\site-packages\torchvision\transforms\transforms.py", line 60, in __call__ img = t(img) File "C:\Users\lenovo\anaconda3\envs\pytorch\lib\site-packages\torch\nn\modules\module.py", line 1051, in _call_impl return forward_call(*input, **kwargs) TypeError: forward() missing 1 required positional argument: 'box'

这是报的错误,谢谢

from contrastivecrop.

xyupeng avatar xyupeng commented on May 29, 2024

You should pass a tuple/list (h_min, w_min, h_max, w_max) normalized in [0, 1] which indicates the box, as in this code.

from contrastivecrop.

xiapeng1110 avatar xiapeng1110 commented on May 29, 2024

Sorry to bother you. I had the same problem, but I still didn't fix it. This is my original code.

trans_list = [ContrastiveCrop(alpha=0.6, size=224, scale=(0.2, 1.0))]    
data_transform_2 = transforms.Compose(trans_list)

pic = data_transform_2(img_test)
plt.imshow(pic)           
plt.show()

I was just trying to visualize the ContrastiveCrop. I also added box after img_test, but I still get an error.

trans_list = [ContrastiveCrop(alpha=0.6, size=224, scale=(0.2, 1.0))]    
data_transform_2 = transforms.Compose(trans_list)

pic = data_transform_2(img_test, [0.1, 0.1, 0.9, 0.9])
plt.imshow(pic)           
plt.show()

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-81-0001e52f5c9e> in <module>
      2 data_transform_2 = transforms.Compose(trans_list)
      3 
----> 4 pic = data_transform_2(img_test, [0.1, 0.1, 0.9, 0.9])
      5 plt.imshow(pic)
      6 plt.show()

TypeError: __call__() takes 2 positional arguments but 3 were given

from contrastivecrop.

xyupeng avatar xyupeng commented on May 29, 2024

Please try CCompose instead, which takes box for the first transformation.

from contrastivecrop.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.